I think the Log4J2 JSONLayout will do what you want:

https://logging.apache.org/log4j/2.x/manual/layouts.html

You would need to copy the Geode log4j2-default.xml from
https://github.com/apache/incubator-geode/blob/develop/gemfire-core/src/main/resources/com/gemstone/gemfire/internal/logging/log4j/log4j2-default.xml

...and use that file as a starting point. Change the gemfire PatternLayout
to JSONLayout and experiment.

Save your custom log4j2-default.xml as log4j2.xml and either place it in
your classpath or start your locators & servers with
-Dlog4j.configurationFile=<your-config-file>.

-Kirk

On Friday, September 4, 2015, Catherine Johnson <[email protected]>
wrote:

> More importantly, I want the content to be escaped JSON, so… if there is a
> stack trace that is thrown, it is already in the right format.
>
> On Sep 4, 2015, at 5:20 PM, Roman Shaposhnik <[email protected]
> <javascript:;>> wrote:
>
> > On Fri, Sep 4, 2015 at 5:06 PM, Catherine Johnson
> > <[email protected] <javascript:;>> wrote:
> >> I don’t really care - I just want the elements (time, message, thread
> name, exception)
> >
> > Ah! But you do ;-) The above (time, message, thread name, exception)
> > is exactly the
> > schema I had in mind. Take a look at
> https://github.com/michaeltandy/log4j-json
> > (or other projects like this). It may be able to do what you want.
> >
> >> to be escaped JSON so I can ingest them elsewhere. I am doing this
> manually now,
> >> but would prefer for Geode to output escaped JSON natively. The sheer
> number of
> >> messages coming out of the system means that I would have to do LOTS of
> transformation
> >> someplace else, but if they were already JSON, it makes processing
> easier.
> >
> > Back at Cloudera we had to create morphlines in order to deal with
> exactly that:
> >
> http://cloudera.github.io/cdk/docs/0.9.1/cdk-morphlines/morphlinesReferenceGuide.html#/readMultiLine
> >
> > Thanks,
> > Roman.
>
>

Reply via email to