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

Robin Coe commented on LOG4J2-908:
----------------------------------

Hi Gary,

One typo in the javadoc of the JSONLayout class:
 "...By default, the JSON layout is not compact (a.k.a. not "pretty") with 
{@code compact="false"},..."

I think that should be (a.k.a. *is* "pretty")

In the case of an unsafe shutdown, is there any concern of a the log file being 
corrupt (insofar as there would be no closing "]") in the context of a log 
parser?  This relates back to my comment of yesterday.  I'm unsure whether 
there's a semantic difference between separate log event documents (i.e., each 
event enclosed in [...] and separated by EOL characters) and a set of 
comma-separated events surrounded by square brackets (i.e., a list of events in 
a single document).  I realize this concern crosses a domain boundary (i.e., 
should log4j2 care about an upstream parser?) but should a log event parser be 
expected to validate the stream?  I don't think so, as it would require 
introducing state into the parser, e.g., to track the opening "[" and match it 
to a closing "]", before parsing.

Sorry if this is off-topic but my use case is in tcp streaming of log events, 
so enclosing them in a single document boundary doesn't make sense and I'm 
wondering if there's really any semantic difference between a stream of 
EOL-delimited json documents and a single document that comma-delimits events?  
If not, could the plugin be made simpler by always using the pattern [{...}]EOL 
and doing away with the associated plugin properties?  If the two 
representations are in-fact different, especially as it concerns an upstream 
parser like logstash, fluentd, elasticsearch, etc., then I apologize for 
muddying this issue.

> JSONLayout doesn't add a comma between log events
> -------------------------------------------------
>
>                 Key: LOG4J2-908
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-908
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Layouts
>    Affects Versions: 2.1
>            Reporter: Konstantinos Liakos
>            Assignee: Gary Gregory
>             Fix For: 2.5.1
>
>
> JSONLayout doesn't output a comma (,) between the log events. This makes it 
> quite difficult to read and deserialize the log files.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to