
Hello Ted, In addition to the date pattern, the date converter admits a second option as the timezone. Thus, the '%date{HH:mm:ss.SSS,Australia/Perth} would print the time in the time zone of Perth Australia, the worlds most isolated city. Givent that the comma ',' is the option separator, the pattern string [HH:mm:ss,SSS] will print the time in the [SSS] time zone which does not exist. Thus, the time will be printed in the default GMT timezone. If you wish to include a comma in your date pattern, then simply enclose the pattern between quotes. For example, %date{"HH:mm:ss,SSS"}. HTH, On 23/03/2010 5:55 AM, Ted Meng wrote:
Hi, I do not remember seeing it in the past but today I used the following simple program to print out log message with slf4j/logback. and to my surprise, it is outputing with GMT time instead of my local time. In other words, slf4j/logback would always print out datetime using GMT for PatternLayout like the following
<layout class="ch.qos.logback.classic.PatternLayout"> <Pattern>%d{MM/dd/yyyy-HH:mm:ss,SSS} %5level %class{1}:%line - %msg%n</Pattern> </layout>
am I doing something wrong or is there a config option to specify output local time instead of the default GMT time.? Thanks very much. Below is the simple program to print out the time that indictates it is using GMT instead of localtime.
import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class L { public static final Logger log = LoggerFactory.getLogger(L.class); public static void main(String[] args) { log.info("test"); } } _______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user