Scalyr Logback and Log4J Appenders

Appenders for Logback and Log4J

License

License

Categories

Categories

Logback Application Layer Libs Logging
GroupId

GroupId

com.scalyr
ArtifactId

ArtifactId

logback-log4j-appenders
Last Version

Last Version

6.0.7
Release Date

Release Date

Type

Type

jar
Description

Description

Scalyr Logback and Log4J Appenders
Appenders for Logback and Log4J
Project URL

Project URL

https://github.com/scalyr/scalyr-logback
Source Code Management

Source Code Management

https://github.com/scalyr/scalyr-logback

Download logback-log4j-appenders

How to add to project

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

Dependencies

compile (1)

Group / Artifact Type Version
com.scalyr : scalyr-client jar 6.0.15

provided (4)

Group / Artifact Type Version
ch.qos.logback : logback-core jar 1.1.7
ch.qos.logback : logback-classic jar 1.1.7
ch.qos.logback : logback-access jar 1.1.7
log4j : log4j jar 1.2.17

test (1)

Group / Artifact Type Version
org.testng : testng jar 6.11

Project Modules

There are no modules declared in this project.

Scalyr Logback/Log4J Appender

This library provides a simple Appender implementation to send log messages to the Scalyr logging service using logback or log4J. With this library, any Java code which uses the log4j or logback APIs can easily integrate with Scalyr.

Adding to your project

With Maven

Add the following dependency to your project's pom.xml (check Maven Central for the latest version):

    <dependency>
        <groupId>com.scalyr</groupId>
        <artifactId>logback-log4j-appenders</artifactId>
        <version>6.0.7</version>
    </dependency>

NOTE: You'll also need the logback or log4j dependencies in your project's pom.xml as well (depending on which one you're using).

If you're using logback, you'll need logback-core, logback-classic, and logback-access (your version numbers may vary):

    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-core</artifactId>
        <version>1.1.7</version>
    </dependency>
    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>1.1.7</version>
    </dependency>
    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-access</artifactId>
        <version>1.1.7</version>
    </dependency>

For log4j, you'll need:

    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
    </dependency>
Downloading JARs directly
  • Download the Java client library from Maven Central and add it to your project.
  • Download the Appender library from Maven Central and add it to your project.
  • Make sure you also have either logback or log4j jars in your project, as described in the section above.

Configuration

Logback

In your logback configuration file, add a com.scalyr.logback.ScalyrAppender. See samples logback.groovy and logback.xml

Log4J

In your log4J configuration file, add a com.scalyr.log4j.ScalyrAppender. See sample log4j.properties

Accounts in eu.scalyr.com

If your Scalyr account is hosted on eu.scalyr.com, you will need to override the scalyrServerAddress configuration variable to use https://upload.eu.scalyr.com. See the comments in the logback.xml sample for an example.

Parsing Rules

Once you have log messages flowing into Scalyr, you can set up parsing rules. The easiest way to do that is to go to your parsers page, find the logback parser in the list, and click either the Ask us to create for you or Ask us to edit for you button. This will send a sample of your log data to the Scalyr staff, and we'll respond the same day with a custom-built parser.

Examples

See src/test/java/com/scalyr/logback/test/Test.java for usage examples.

com.scalyr

Versions

Version
6.0.7
6.0.6
6.0.5
6.0.1
6.0.0