Log4J - Can you format time in GMT using the .properties file?

J

Jeff O.

I'm trying to format date/time stamp in the log4J log in GMT. Is
there a way to do this using this .properties file? If not, how do I
get GMT output?
 
P

Paul Lutus

Jeff said:
I'm trying to format date/time stamp in the log4J log in GMT. Is
there a way to do this using this .properties file? If not, how do I
get GMT output?

That depends. Show us your code -- a brief, compilable, working example.
Someone will then correct it.
 
J

Jeff O.

Here's the log4j.properties file code I have. I'm trying to get the
log file to display the time in UTC. For example, instead of
2004-09-28 13:00:00.000 GMT-0500, I want to display 2004-09-28
17:00:00.00 GMT-0000. Any suggestions?


# ExportAutomation Log4J configuration Properties.

log4j.rootLogger=@LOG4J_ROOT_APPENDERS@

log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=../beans/groupsubgroup/log/EventLog.txt
log4j.appender.R.MaxFileSize=900KB

# Keep 20 backup files
log4j.appender.R.MaxBackupIndex=20
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%-5p %d{yyyy-MM-dd
HH:mm:ss.SSS 'GMT'Z} %c [%t] - %m%n

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=>> %-4r - %m%n

# SMTP appender
log4j.appender.SMTPTest=org.apache.log4j.net.SMTPAppender
log4j.appender.SMTPTest.layout=org.apache.log4j.PatternLayout
log4j.appender.SMTPTest.layout.ConversionPattern=%d %-5p [%t] - %m%n
log4j.appender.SMTPTest.To=@TO_MAIL@
log4j.appender.SMTPTest.SMTPHost=smtpna1.ford.com
log4j.appender.SMTPTest.Subject=@SMTP_MAIL_SUBJECT@
[email protected]
log4j.appender.SMTPTest.BufferSize=50
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top