Search code examples
javalogginglog4jlog4j2syslog

What is equivalent to log4j 1 `log4j.appender.SYSLOG.Header=true` in log4j 2?


I'm migrating a log4j.properties to log4j2.xml. Syslog appender in the former has a configuration

log4j.appender.SYSLOG.Header=true

What's the equivalent setting in log4j2.xml?


Solution

  • There is no need to do anything:

    In log4j 1, setting log4j.appender.SYSLOG.Header=true resulted in the appender including the HEADER part (that is, timestamp and host name) of the syslog packet.

    In log4j 2, the timestamp and host name are always included. (Looks like this cannot be switched off.)