[ 
https://issues.apache.org/jira/browse/LOG4J2-1465?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15493731#comment-15493731
 ] 

Gary Gregory commented on LOG4J2-1465:
--------------------------------------

This is what we have today:

* ConsoleAppender - PatternLayout.createDefaultLayout()
* FileAppender - PatternLayout.createDefaultLayout()
* FlumeAppender - RFC5424Layout
* JmsAppender - SerializedLayout.createLayout()
* KafkaAppender - Calls StringEncoder.toBytes() for each event if there is no 
layout
* MemoryMappedFileAppender - PatternLayout.createDefaultLayout()
* RandomAccessFileAppender - PatternLayout.createDefaultLayout()
* RollingFileAppender - PatternLayout.createDefaultLayout()
* RollingRandomAccessFileAppender - PatternLayout.createDefaultLayout()
* SmtpAppender - HtmlLayout.createDefaultLayout()
* SocketAppender - SerializedLayout.createLayout()
* JeroMQAppender - PatternLayout.createDefaultLayout()

It's nice to have reasonable configuration by exception so I can get up and 
running first and refine as I need to; as opposed to spending a lot of time 
building a config file first, which feels like a barrier to entry.

The site docs and Javadoc could be updated of course.

This ticket seems to be more about documentation now assuming that these 
defaults are reasonable.

> 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-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-dev-h...@logging.apache.org

Reply via email to