[
https://issues.apache.org/jira/browse/LOG4J2-2250?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16365035#comment-16365035
]
Remko Popma edited comment on LOG4J2-2250 at 2/15/18 1:53 AM:
--------------------------------------------------------------
Java 8 is not required. We just need to pass a date format String to the
underlying {{SimpleLogger}} used by the status logger.
Something like the below should suffice:
{code}
private StatusLogger(final String name, final MessageFactory
messageFactory) {
super(name, messageFactory);
this.logger = new SimpleLogger("StatusLogger", Level.ERROR, false,
true, false, false,
System.getProperty("log4j2.StatusLogger.dateformat",
Strings.EMPTY),
messageFactory, PROPS, System.err);
this.listenersLevel = Level.toLevel(DEFAULT_STATUS_LEVEL,
Level.WARN).intLevel();
...
{code}
Then, users can set system property {{log4j2.StatusLogger.dateformat}} to
{{"yyyy-MM-dd'T'HH:mm:ss,SSS"}} to get the ISO8601 timestamp format in the
status logs.
Alternatively, this setting can be specified in a
{{log4j2.StatusLogger.properties}} file in the classpath.
was (Author: [email protected]):
Java 8 is not required. We just need to pass a date format String to the
underlying {{SimpleLogger}} used by the status logger.
Something like the below should suffice:
{code}
private StatusLogger(final String name, final MessageFactory
messageFactory) {
super(name, messageFactory);
this.logger = new SimpleLogger("StatusLogger", Level.ERROR, false,
true, false, false,
System.getProperty("status.dateformat", Strings.EMPTY),
messageFactory, PROPS, System.err);
this.listenersLevel = Level.toLevel(DEFAULT_STATUS_LEVEL,
Level.WARN).intLevel();
...
{code}
> Need ISO8601 timestamp for StatusLogger
> ---------------------------------------
>
> Key: LOG4J2-2250
> URL: https://issues.apache.org/jira/browse/LOG4J2-2250
> Project: Log4j 2
> Issue Type: Improvement
> Components: Core
> Affects Versions: 2.10.0
> Reporter: Atle Tokle
> Priority: Minor
>
> We use a log-indexing system that uses the date-format to see where next log
> line begins.
> And have a requirement to standardize on ISO8601 format. But the lines
> written by StatusLogger when Log4j2 has a different format. I would like a
> configuration option that could specify the format. i.e.
> {code:java}
> <configuration verbose="true" status="trace" dateformat="ISO8601" >
> ...
> ...
> </configuration>{code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)