There are three steps to this:
1) Add log4j-extras dependency here
2) Set the layout in EnhancedPatternLayout: log4j.appender.stdout.layout=org.apache.log4j.EnhancedPatternLayout (change stdout to whatever you use)
3) Add your time zone in braces after your date template 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 the list of timezone identifiers available in java here or here
creativcoder
source share