Stackify Log Appender for Log4j


License

License

GroupId

GroupId

com.stackify
ArtifactId

ArtifactId

stackify-log-log4j12
Last Version

Last Version

4.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

Stackify Log Appender for Log4j
Stackify Log Appender for Log4j
Project URL

Project URL

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

Project Organization

Stackify, LLC
Source Code Management

Source Code Management

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

Download stackify-log-log4j12

How to add to project

<!-- https://jarcasting.com/artifacts/com.stackify/stackify-log-log4j12/ -->
<dependency>
    <groupId>com.stackify</groupId>
    <artifactId>stackify-log-log4j12</artifactId>
    <version>4.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.stackify/stackify-log-log4j12/
implementation 'com.stackify:stackify-log-log4j12:4.0.0'
// https://jarcasting.com/artifacts/com.stackify/stackify-log-log4j12/
implementation ("com.stackify:stackify-log-log4j12:4.0.0")
'com.stackify:stackify-log-log4j12:jar:4.0.0'
<dependency org="com.stackify" name="stackify-log-log4j12" rev="4.0.0">
  <artifact name="stackify-log-log4j12" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.stackify', module='stackify-log-log4j12', version='4.0.0')
)
libraryDependencies += "com.stackify" % "stackify-log-log4j12" % "4.0.0"
[com.stackify/stackify-log-log4j12 "4.0.0"]

Dependencies

compile (3)

Group / Artifact Type Version
com.stackify : stackify-api-java jar 4.0.0
com.fasterxml.jackson.core : jackson-databind jar 2.9.9.3
log4j : log4j jar 1.2.17

provided (1)

Group / Artifact Type Version
org.projectlombok : lombok jar 1.16.10

test (6)

Group / Artifact Type Version
org.slf4j : slf4j-log4j12 jar 1.7.5
junit : junit jar 4.11
org.mockito : mockito-core jar 1.9.5
org.powermock : powermock-core jar 1.5.6
org.powermock : powermock-module-junit4 jar 1.5.6
org.powermock : powermock-api-mockito jar 1.5.6

Project Modules

There are no modules declared in this project.

Maven Central

Stackify Log4j 1.2 Logger

Log4j 1.2 appender for sending log messages and exceptions to Stackify.

Installation

Add it as a maven dependency:

<dependency>
    <groupId>com.stackify</groupId>
    <artifactId>stackify-log-log4j12</artifactId>
    <version>4.0.1</version>
    <scope>runtime</scope>
</dependency>

Usage

Example appender configuration (*.properties file):

log4j.appender.STACKIFY=com.stackify.log.log4j12.StackifyLogAppender
log4j.appender.STACKIFY.apiKey=YOUR_API_KEY
log4j.appender.STACKIFY.application=YOUR_APPLICATION_NAME
log4j.appender.STACKIFY.environment=YOUR_ENVIRONMENT

Example appender configuration (*.xml file):

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

Note: If you are logging from a device that has the stackify-agent installed, the environment setting is optional. We will use the environment associated to your device in Stackify.

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

org.apache.log4j.LogManager.shutdown();

Masking

The Stackify appender has built-in data masking for credit cards and social security number values.

Enable Masking:

Add <param name="maskEnabled" value="true"/> inside the <appender> ... </appender> tag.

Customize Masking:

The example below has the following customizations:

  1. Credit Card value masking is disabled (<param name="maskCreditCard" value="false"/>)
  2. IP Address masking is enabled (<param name="maskIP" value="true"/>).
  3. Custom masking to remove vowels using a regex (<param name="maskCustom" value="[aeiou]"/> )
log4j.appender.STACKIFY=com.stackify.log.log4j12.StackifyLogAppender
log4j.appender.STACKIFY.apiKey=YOUR_API_KEY
log4j.appender.STACKIFY.application=YOUR_APPLICATION_NAME
log4j.appender.STACKIFY.environment=YOUR_ENVIRONMENT
 
log4j.appender.STACKIFY.maskEnabled=true
log4j.appender.STACKIFY.maskCreditCard=false
log4j.appender.STACKIFY.maskSSN=true
log4j.appender.STACKIFY.maskIP=true
log4j.appender.STACKIFY.maskCustom=[aeiou]
<appender name="STACKIFY" class="com.stackify.log.log4j12.StackifyLogAppender">
    <param name="apiKey" value="YOUR_API_KEY"/>
    <param name="application" value="YOUR_APPLICATION_NAME"/>
    <param name="environment" value="YOUR_ENVIRONMENT"/>
      
    <param name="maskEnabled" value="true"/>
    <param name="maskCreditCard" value="false"/>
    <param name="maskSSN" value="true"/>
    <param name="maskIP" value="true"/>
    <param name="maskCustom" value="[aeiou]"/> 
</appender>

Legacy Support

For legacy support of Java 1.6 and 1.7 use the following maven dependency:

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

License

Copyright 2020 Stackify, LLC.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

com.stackify

Stackify

Stackify helps developers manage and troubleshoot application problems with integrated monitoring, metrics, errors & logs.

Versions

Version
4.0.0
2.1.2
2.1.1
2.1.0
2.0.2
2.0.1
1.1.9
1.1.8
1.1.7
1.1.6
1.1.5
1.1.4
1.1.3
1.1.2
1.1.1
1.1.0
1.0.16
1.0.15
1.0.14
1.0.13
1.0.12
1.0.11
1.0.10
1.0.8
1.0.7
1.0.6
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0