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

Remko Popma edited comment on LOG4J2-1244 at 1/6/16 1:56 AM:
-------------------------------------------------------------

Took a quick look at the patch:
* Maybe we should pull PatternLayout.Serializer up to 
AbstractStringLayout.Serializer? Would that potentially break client code? (It 
looks a bit strange for AbstractStringLayout to use an interface defined in one 
of its subclasses.)
* AbstractStringLayout#getFooter and #getHeader should return 
super.getFooter/Header if the serializer is {{null}}.
* All layouts extending AbstractLayout now need a Configuration object to be 
constructed; unit testing is slightly easier if this is not required but I 
guess there is no way around this :-)

These are just minor things, overall looks good. Quick work, Gary!


was (Author: [email protected]):
Took a quick look at the patch:
* Maybe we should pull PatternLayout.Serializer up to 
AbstractStringLayout.Serializer? Would that potentially break client code? (It 
looks a bit strange for AbstractStringLayout to use an interface defined in one 
of its subclasses.)
* AbstractStringLayout#getFooter and #getHeader should return 
super.getFooter/Header if the serializer is {{null}}.
* All layouts extending AbstractLayout now need a Configuration object to be 
constructed; unit testing is slightly easier if this is not required but I 
guess there is no way around this :-)

> Make header and footer values customizable in JSONLayout
> --------------------------------------------------------
>
>                 Key: LOG4J2-1244
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1244
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: Layouts
>            Reporter: Anshu Garg
>            Assignee: Gary Gregory
>         Attachments: logging-log4j2.patch
>
>
> It will be helpful to provide a way to customize header and footer in 
> JSONLayout in Log4j 2.
> For instance user is writing a logging application which logs requests and 
> responses to/from a server to log files in JSON format. Now user also wants 
> to log server specific information in each log file but since it will be 
> common for all request/response, it is not desired to be logged with each log 
> entry so user wants to add server specific common information at start of the 
> file. As header in JSON format or in this use case. This will be followed by 
> each request and response logged as a JSON array element. And at rollover 
> this JSON array and main JSON object  (which contains header and JSON array) 
> should  be closed with help of footer.
> A typical file will be something like ...
> {code}
> {"Header":{"ServerName":"MyAppServer"},"LogEntries":[
> {"Message":"Request 
> message1","RequestingAddress":"127.0.0.1","TimeStamp":"2016-01-05_07-24-59"},
> {"Message":"Request 
> message1","RequestingAddress":"127.0.0.1","TimeStamp":"2016-01-05_07-24-59"},
> {"Message":"Request 
> message1","RequestingAddress":"127.0.0.1","TimeStamp":"2016-01-05_07-24-59"},
> {"LogEndMarker":"END"}
> ]}
> {code}



--
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