mp911de / logstash-gelf

Graylog Extended Log Format (GELF) implementation in Java for all major logging frameworks: log4j, log4j2, java.util.logging, logback, JBossAS7 and WildFly 8-12
http://logging.paluch.biz
MIT License
425 stars 102 forks source link

Is it possible to have pattern layout messages working? #202

Closed cristianb1989 closed 5 years ago

cristianb1989 commented 5 years ago

Could you please provide an example on how to create a log message containing the Timestamp, ThreadId, ClassName: log4j.appender.graylog2.layout.ConversionPattern=%d{yy-MM-dd HH:mm:ss} [%t] %-5p %c{2}: %m%n

Basically I'd like to have the possibility creating pattern layouts like here: https://logging.apache.org/log4j/2.x/manual/layouts.html#PatternLayout

Is this a functionality supported? Please bear in mind that it was working here https://github.com/graylog-labs/log4j2-gelf

mp911de commented 5 years ago

Just to make sure, we're talking about Log4j2.

You can use log4j2 substitutions in your logging config. See log4j2-dynamic-mdc.xml for an example.