Errors and Logs: Configure log4j

Downloads and Includes

The stackify-log-log4j12 project is open source and hosted on GitHub here.

Maven artifacts are available in the central Maven repository within a few hours after a new release.

The group id is com.stackify. The artifact id is stackify-log-log4j12. Substitute the version number you wish to use in the dependency snippet below.



Configuration via Properties file:

log4j.rootLogger=..., STACKIFY

Configuration via XML file:

<appender name="STACKIFY" class="com.stackify.log.log4j12.StackifyLogAppender">
    <param name="apiKey" value="YOUR_ACTIVATION_KEY"/>
    <param name="application" value="YOUR_APPLICATION_NAME"/>
    <param name="environment" value="YOUR_ENVIRONMENT"/>
    <appender-ref ref="STACKIFY" />

Be sure to shut down Log4j to flush this appender of any errors and shutdown the background thread:



Sending Logs Through a Proxy

If you are wanting to send your logs into Stackify through a proxy, you will want to set the ‘https.proxyHost’ and ‘https.proxyPort’ system properties. If both of these properties are set in your app, your logs go through the proxy specified.

Advanced Features: MDC, and NDC

Advanced Features: MDC, and NDC

If you’re utilizing MDC (Mapped Diagnostic Context) or NDC (Nested Diagnostic Context), Stackify will automatically pick up and report any data you add via MDC/NDC. This information will be available to you under the Custom Properties heading in the error details screen within Retrace.