Support Logging setup Java Logback using HTTP/S

Java Logback Using HTTP/S

You can send your Java logs using our Logback extension. It sends directly from your application to Loggly using the HTTP/S Event API.

We automatically parse out the timestamp, method, fully classified class name, thread, and log level from these log lines. It also allows you to send properly formatted multiline stacktraces. Please note that the HTTP protocol has a data rate that is limited by your latency to our log collector. This guide uses logback-ext-loggly version 0.1.2 or higher, and the default Logback configuration. For alternatives, please see the Advanced Options section.

Java Logback Setup

1. Add Logback Extension

Add a dependency for the Loggly Logback extension from the Maven repository or from GitHub. The Maven repository has code snippets to add the dependencies for many common package managers.

For example, if you are using Maven, then add this to the dependencies section of your pom.xml file.


Then run maven to install the extension

mvn clean install

2. Logback Configuration

Open or create your logback.xml configuration file and add the LogglyAppender. The following pattern will parse the log as Java log in Loggly and it also parses the objects in JSON format and string in the plain text format.

<configuration debug="true">
   <appender name="loggly" class="ch.qos.logback.ext.loggly.LogglyAppender">
       <pattern>%d{"ISO8601", UTC}  %p %t %c %M - %m%n</pattern>
   <root level="info">
       <appender-ref ref="loggly" />


3. Add Logging Code

Add code to construct a SLF4J Logger and then send a test event.

import org.slf4j.*;
final static Logger logger = LoggerFactory.getLogger();"Hello World from Logback!");"{"message" : "Hello World from Logback!"}");

4. Send Test Events

Run your application to send test events to Loggly.

5. Verify Events

Search Loggly for events with tag as Logback over the past 20 minutes. It may take a few minutes to index the event. If it doesn’t work, see the troubleshooting section below.


Click on one of the logs to show a list of Java or JSON fields (see screenshot below). If you don’t see them, please check that you are using one of our automatically parsed formats.
Java Logback Example

6. Next Steps

Advanced Java Logback Options

  • Java Logback Using Syslog – send logs using the syslog protocol for nonblocking and higher data rate applications
  • Java Log4j – Send Log4j logs over syslog if you prefer local centralized management
  • HTTP/S Bulk Endpoint – Send up to 5MB batches of logs over HTTP/S for higher performance
  • Log File Monitoring – You can also configure Log4j with a FileAppender, then monitor that file using Rsyslog. This gives you a local backup.
  • Loggly Libraries Catalog – There are libraries available for Log4j over HTTP if you don’t have system level access, as well as SLF4j
  • Search or post your own Java Logback or Java logging questions in the community forum.

Troubleshooting Java Logging

If you don’t see any data show up in the verification step, then check for these common problems.

Check Logback:

    • Wait a few minutes in case indexing needs to catch up.
    • Verify Logback is working, such as by setting up a local file appender with the same format.
    • See our HTTP Troubleshooting Guide to verify HTTP events are being sent to Loggly.

Still Not Working?

Thanks for the feedback! We'll use it to improve our support documentation.