I want the log should contain date entries of specific timezone. Is there any way of forcing timezone in log4j.properties
?
Now I am using JDK 1.5, As you al
There are three steps to this:
1) Add the log4j-extras
dependency here
2) Set the layout to EnhancedPatternLayout:
log4j.appender.stdout.layout=org.apache.log4j.EnhancedPatternLayout
(change stdout
to whatever appender you are using)
3) Add your timezone in braces after your date time pattern
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss}{IST} %-5p %c{1}:%L - %m%n
(Here IST in my case)
You can refer to list of timezone ID's available in java here or here