newrelic / java-log-extensions

Source for the New Relic Java log framework extensions.
Apache License 2.0
15 stars 22 forks source link
telemetry-java

New Relic Open Source community plus project banner.

New Relic logging extensions

The New Relic logging plugins are extensions for common Java logging frameworks. They are designed to capture app, transaction trace, and span information as part of your application log messages.

For the latest information, please see the New Relic Documentation.

We support:

Configuration Options

The following config options apply to all supported logging frameworks, with some noted exceptions.

Mapped Diagnostic Context (MDC)

Not all logging frameworks provide an MDC mechanism (e.g. JUL) but for those that do you can configure the logging extension to add the MDC data in addition to the trace context data from New Relic.

Default for adding MDC is false, change this to true if you wish to include MDC data on log events. It can be configured by environment variable (NEW_RELIC_LOG_EXTENSION_ADD_MDC=boolean) or system property (-Dnewrelic.log_extension.add_mdc=boolean).

Note that, if set to true all MDC data will be added to log events. Currently, there is no filtering capability for excluding specific MDC entries.

MDC data will be added to log events with a context. prefix to distinguish it as user defined context data as well as to prevent potential collisions with New Relic specific context keys.

Exception Stack Trace Size

Note: The log extensions now have the ability to capture the entire stack trace - specifically any caused by sections. Prior versions of the extension only reported the trace for the thrown exception and ignored any nested caused by Throwables.

You can configure the logging extension to control the max stack trace size for exceptions added to log events.

Default max stack trace size is 300. It is recommended that you do not exceed this value or data could be dropped or truncated as well as lead to higher log event ingest costs. Max stack trace size can be configured by environment variable (NEW_RELIC_LOG_EXTENSION_MAX_STACK_SIZE=integer) or system property (-Dnewrelic.log_extension.max_stack_size=integer).

Explicitly setting this property to 0 will not impose a maximum size constraint on the stack trace size.

Support

Should you need assistance with New Relic products, you are in good hands with several diagnostic tools and support channels.

If the issue has been confirmed as a bug or is a Feature request, please file a Github issue.

Support Channels

Contributing

We encourage your contributions to improve the log extensions. Keep in mind when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. You only have to sign the CLA one time per project. If you have any questions, or to execute our corporate CLA, required if your contribution is on behalf of a company, please drop us an email at opensource@newrelic.com.

A note about vulnerabilities

As noted in our security policy, New Relic is committed to the privacy and security of our customers and their data. We believe that providing coordinated disclosure by security researchers and engaging with the security community are important means to achieve our security goals.

If you believe you have found a security vulnerability in this project or any of New Relic's products or websites, we welcome and greatly appreciate you reporting it to New Relic through HackerOne.