Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

An issue with outputting log4j date in terminal (ubuntu)

Hey I have problem with output the date format from log4j property in terminal.

Here's part from the prop. file:

log4j.rootLogger=INFO, CONSOLE

log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.Target=System.err
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.conversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p - %m%n

and the output in Eclipse is: 2013-06-10 14:38:21,478 INFO but in terminal, where I expect the same output it's 13/06/10 14:38:21 INFO

So any ideas how can i have the same output as the one in Eclipse, is it from the log4j property file or?

Thanks in advance! :)

like image 778
Sunay Hashimov Avatar asked Nov 12 '22 03:11

Sunay Hashimov


1 Answers

Try like this way.

log4j.appender.CONSOLE.DatePattern=%d{yyyy-MM-dd HH:mm:ss,SSS}
log4j.appender.CONSOLE.layout.conversionPattern=%m%n

set separately DatePattern and conversionPattern i thing it ll helps you.

like image 135
KhAn SaAb Avatar answered Nov 14 '22 21:11

KhAn SaAb