bwaldvogel / log4j-systemd-journal-appender

Log4j appender for systemd-journal that maintains structured log data
BSD 3-Clause "New" or "Revised" License
24 stars 14 forks source link

Layout setting should be possible for the Journal appender #3

Closed Jajcus closed 9 years ago

Jajcus commented 9 years ago

From the README:

This will tell Log4j to log to systemd journal as well as to stdout (console). Note that a layout is not set for the SystemdJournalAppender and would be ignored if given. This is because meta data of a log event such as the timestamp, the logger name or the Java thread name are mapped to systemd- journal fields and need not be rendered into a string that loses all the semantic information.

Having the meta-data stored in the journal fields is great, but that doesn't mean, that they are useless in the log message. Otherwise normal view of the journal would miss lots of important data. The verbose view is too verbose for regular use and still doesn't provide everything that could be included in log4j layout.

It should be possible to use standard log4j layout syntax to customize formatting of the log message. It won't make much sense to include e.g. timestamp there (as journal viewing tools always provide that), but showing class or thread name may be useful.