Scalyr support for Logback logging
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

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):


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):


For log4j, you'll need:

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.



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


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

Accounts in

If your Scalyr account is hosted on, you will need to override the scalyrServerAddress configuration variable to use 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.


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