You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Mikael Ståldal (JIRA)" <ji...@apache.org> on 2017/01/25 09:04:26 UTC

[jira] [Closed] (LOG4J2-1465) Default layouts for various appenders could be more consistent

     [ https://issues.apache.org/jira/browse/LOG4J2-1465?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mikael Ståldal closed LOG4J2-1465.
----------------------------------

> Default layouts for various appenders could be more consistent
> --------------------------------------------------------------
>
>                 Key: LOG4J2-1465
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1465
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: Appenders
>    Affects Versions: 2.6.2
>            Reporter: Mikael Ståldal
>            Assignee: Mikael Ståldal
>             Fix For: 2.7
>
>
> The appenders with layout support have different layouts as default. This could be improved, made more consistent and better documented:
> According to documentation:
> * ConsoleAppender - pattern %m%n
> * FileAppender - no default
> * FlumeAppender - RFC5424Layout
> * JMSAppender - SerializedLayout
> * KafkaAppender - formatted message
> * MemoryMappedFileAppender - no default
> * RandomAccessFileAppender - no default
> * RollingFileAppender - no default
> * RollingRandomAccessFileAppender - no default
> * SMTPAppender - SerializedLayout
> * SocketAppender - SerializedLayout
> * JeroMQAppender - _If you do not specify a layout, the appender uses the default pattern appender returned by PatternLayout.createDefaultLayout()_
> This is not accurate though, e.g. FileAppender (and its variants) have pattern %m%n as default.
> First we should update the documentation to match the implementation. But maybe we should also consider changing some of the defaults.
> I think that pattern %m%n make sense as default for Console and the various File appenders.
> I assume that RFC5424 make sense as default for Flume, but I don't know about Flume.
> I don't think that pattern %m%n make sense as default for JeroMQ. And it was probably a mistake (by me) to make formatted message as default for Kafka.
> And as highlighted by https://issues.apache.org/jira/browse/LOG4J2-1226 it's not good to have SerializedLayout as default for any appender.
> I suggest that the "generic binary" appenders JMSAppender, KafkaAppender, SocketAppender and JeroMQAppender have no default layout, make it mandatory to specify a layout for them. That will force the user to make a conscious choice of layout, which I think is good.
> SMTPAppender should probably have pattern %m%n as default just like Console and File.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org