How to add the time stamp to the log file

Posted by swati on Stack Overflow See other posts from Stack Overflow or by swati
Published on 2010-04-08T07:37:23Z Indexed on 2010/04/08 7:43 UTC
Read the original article Hit count: 351

Filed under:
|
|

ello Everyone, I am new to using apache logger . I have downloaded the log4j-xx and i have the following text configuration file Set root logger level to DEBUG and its only appender to mainFormat.

log4j.rootLogger = TRACE, mainFormat, FILE mainFormat is set to be a ConsoleAppender.

log4j.appender.mainFormat=org.apache.log4j.ConsoleAppender mainFormat uses PatternLayout.

log4j.appender.mainFormat.layout=org.apache.log4j.PatternLayout log4j.appender.mainFormat.layout.ConversionPattern=%d [%t] %-5p %c - %m%n File makes a file of the output.

log4j.appender.FILE=org.apache.log4j.FileAppender log4j.appender.FILE.File=log4j_HAPR001_OutputFile.log log4j.appender.FILE.layout=org.apache.log4j.PatternLayout log4j.appender.FILE.layout.ConversionPattern=%d [%t] %-5p %c - %m%n

i use the above config file to create the log file. Now i wanted to add the current time stamp to the log file. Is there any way to do this. If yes can some one please give me the instructions how to do. Thanks in advance.

© Stack Overflow or respective owner

Related posts about logging

Related posts about apache