Support & Documentation
Follow

Errors and Logs: log4j

Downloads and Includes

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

https://github.com/stackify/stackify-log-log4j12

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

http://search.maven.org/#browse%7C-2044432631

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.

<dependency>
    <groupId>com.stackify</groupId>
    <artifactId>stackify-log-log4j12</artifactId>
    <version>INSERT_LATEST_MAVEN_CENTRAL_VERSION</version>
</dependency>

Configuration

If you're doing configuration via Properties file:

log4j.appender.STACKIFY=com.stackify.log.log4j12.StackifyLogAppender
log4j.appender.STACKIFY.apiKey=YOUR_ACTIVATION_KEY
log4j.appender.STACKIFY.application=YOUR_APPLICATION_NAME
log4j.appender.STACKIFY.environment=YOUR_ENVIRONMENT
...
log4j.rootLogger=..., STACKIFY

Or, 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>
...
<root>
    ...
    <appender-ref ref="STACKIFY" />
</root>

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

LogManager.shutdown();

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

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk