- log4j 2.x must be configured and working in the application.
- The New Relic Java agent must be enabled using the
-javaagent
command-line parameter. - You must be using at least version 5.6.0 of the Java Agent.
There are some changes to your application to use the New Relic log4j 2.x Extension. All steps are required.
Refer to Maven Central for the appropriate snippets.
Update your logging configuration xml to add <NewRelicLayout/>
like this:
<File name="MyFile" fileName="logs/app-log-file.log">
<NewRelicLayout/>
</File>
or like this:
<Console name="MyConsole">
<NewRelicLayout/>
</Console>
Why? The New Relic log format is a tailored JSON format with specific fields in specific places that our log forwarder plugins and back end rely on. At this time, we don't support any customization of that format.