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 "Robin Coe (JIRA)" <ji...@apache.org> on 2016/01/01 04:50:39 UTC

[jira] [Comment Edited] (LOG4J2-908) JSONLayout doesn't add a comma between log events

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

Robin Coe edited comment on LOG4J2-908 at 1/1/16 3:50 AM:
----------------------------------------------------------

I see your point.  In that question, the solution is to use a json_lines codec, which effectively requires each log event to be sent individually.  If you send a stream of json events in batch mode, logstash will not process them.  But there is another logstash codec for json streams, which processes an array of comma delimited elements.  The first codec requires an EOL and the second codec requires commas.

I'm not sure whether logstash can process a json object itself, i.e., an array wrapped in [].  If it can, I expect it to require the json_lines codec and the format would probably need to look like:
[{event}]
[{event}]

as opposed to 
[
{event},
{event}
]

Not knowing is why I was asking about the semantic difference between a stream of json objects, i.e., [{}][{}]..., vs. an array of elements in a json object, i.e., [{},{},...].  If there is none, then finding a format that works in batch mode is preferred.


was (Author: rcoe67):
I see your point.  In that question, the solution is to use a json_lines codec, which effectively requires each log event to be sent individually.  If you send a stream of json events in batch mode, logstash sill not process them.  But there is another logstash codec for json streams, which processes an array of comma delimited elements.  The first codec requires an EOL and the second codec requires commas.

I'm not sure whether logstash can process a json object itself, i.e., an array wrapped in [].  If it can, I expect it to require the json_lines codec and the format would probably need to look like:
[{event}]
[{event}]

as opposed to 
[
{event},
{event}
]

Not knowing is why I was asking about the semantic difference between a stream of json objects, i.e., [{}][{}]..., vs. an array of elements in a json object, i.e., [{},{},...].  If there is none, then finding a format that works in batch mode is preferred.

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