這是我的日誌輸出log4j的每個日誌條目的時間戳
INFO main digestemails - process inbox
INFO main digestemails - checking for emails in c:\development\DCMail\email\KN-Source
INFO main digestemails - digesting [email protected]
INFO main digestemails - extracting attachments
INFO main digestemails - no attachments or no attachments supported
INFO main digestemails - updating database
INFO main digestemails - email -> COMPLETED folder
INFO main digestemails -
我想每個日誌消息的時間戳即
INFO 2008-12-25 13:14:00 digestemails - email -> COMPLETED folder
這裏是我的log4j的配置文件
log4j.rootLogger=debug, stdout, R
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=c:\\development\\DCMail\\logs\\digestlogfolder\\digest-logfile.log
log4j.appender.R.MaxFileSize=100KB
# Keep one backup file
log4j.appender.R.MaxBackupIndex=1
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
我該怎麼做?
只是爲了增加這方面的一個提取物,我想使我的課的簽名小,所以我用'%d {DD MMM YYYY HH:MM:SS,SSS}% -4r [%t]%-5p%c {1}%x - %m%n`。 ** {1} **僅打印c,而不打印類簽名的a.b.c。 – Siddharth 2013-05-04 06:37:53