Make Your Logs Work for You

The days of logging in to servers and manually viewing log files are over. SolarWinds® Papertrail™ aggregates logs from applications, devices, and platforms to a central location.

View Technology Info

FEATURED TECHNOLOGY

Troubleshoot Fast and Enjoy It

SolarWinds® Papertrail™ provides cloud-based log management that seamlessly aggregates logs from applications, servers, network devices, services, platforms, and much more.

View Capabilities Info

FEATURED CAPABILITIES

Aggregate and Search Any Log

SolarWinds® Papertrail™ provides lightning-fast search, live tail, flexible system groups, team-wide access, and integration with popular communications platforms like PagerDuty and Slack to help you quickly track down customer problems, debug app requests, or troubleshoot slow database queries.

View Languages Info

FEATURED LANGUAGES

TBD - APM Integration Title

TBD - APM Integration Description

TBD Link

APM Integration Feature List

TBD - Built for Collaboration Title

TBD - Built for Collaboration Description

TBD Link

Built for Collaboration Feature List

Collect Logs: Apps & Services > Java logback

Java logback

Introduction

logback is “intended as a successor to the popular log4j project.”

Papertrail supports aggregating messages from a native logback appender, providing a live searchable console for your Java (JRE/JVM) app logs, including Scala apps using frameworks like Lift and Play.

Papertrail can receive logback messages using logback-syslog4j (com.papertrailapp.logback.Syslog4jAppender) or the older original logback ch.qos.logback.classic.net.SyslogAppender. As described below, we recommend logback-syslog4j.

Install logback

Install logback in your app or J2EE servlet container. This is basically adding the jars to your classpath, creating a logback.xml, and loading and invoking the classes to output messages (such as logger.debug("Success!");).

Choose appender

logback outputs logs to one or more appenders (such as file, console, or syslog). Papertrail recommends the logback-syslog4j appender (com.papertrailapp.logback.Syslog4jAppender) because it includes TCP, TCP with TLS, and Google App Engine support, as well as relying on syslog4j for message transmission.

If adding an appender to pom.xml is not possible, or you prefer the standard logback SyslogAppender, this appender can also can send to Papertrail.

Syslog4jAppender (recommended)

Visit logback-syslog4j README and follow the step-by-step instructions.

In the logback.xml example in the README, replace host and port with the details from Papertrail’s Add Systems page. Replace ident with a name of your app, or other attribute that Papertrail should use to identify the sending app.

Customize sender name and identifier

To change the appearance of the sender name and program/calling method name in Papertrail:

  • add 
<sendLocalTimestamp>false</sendLocalTimestamp> & <sendLocalName>false</sendLocalName> to <syslogConfig>
  • remove the <ident> tag
  • replace the layout pattern under under Syslog4jAppender with the following:
<pattern>%d{MMM dd HH:mm:ss} HOSTNAME APPNAME: %-5level %logger{35}: %m%n%xEx</pattern>

HOSTNAME will appear as the sender name in Papertrail, and APPNAME will appear as the program.

SyslogAppender

Edit logback.xml and add this within the <appenders> block.

In the sample below, replace logsN and XXXXX with the details from Papertrail’s Add Systems page. Replace my-app with a name of your app, or other attribute that Papertrail should use to identify this sender.

<appender name="PAPERTRAIL" class="ch.qos.logback.classic.net.SyslogAppender">
  <syslogHost>logsN.papertrailapp.com</syslogHost>
  <port>XXXXX</port>
  <facility>USER</facility>
  <suffixPattern>my-app: %logger %msg</suffixPattern>  
</appender>

Enable SyslogAppender

Outside of the appenders section (in the <root> block), add this to enable the syslog appender you just created:

<appender-ref ref="PAPERTRAIL" />

An example might look like this:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <encoder>
      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{5} -
%msg%n</pattern>
    </encoder>
  </appender>
  <root level="DEBUG">
    <appender-ref ref="STDOUT" />
    <appender-ref ref="PAPERTRAIL" />
  </root>
</configuration>

Formatting

An alternative suffixPattern that puts the %thread variable in the position that’s used for clickable context (instead of my-app above):

<suffixPattern>%thread: %-5level %logger{36} - %msg%n</suffixPattern>

Troubleshooting

I’m using the Spark framework and no logs are appearing in Papertrail

Spark and logback rely on SLF4J, so to avoid including it twice it must be excluded as a dependency.

Enable logback debug mode

logback supports a debug mode for its own operations. To enable it, change the outer <configuration> tag to <configuration debug="true">.

More

The scripts are not supported under any SolarWinds support program or service. The scripts are provided AS IS without warranty of any kind. SolarWinds further disclaims all warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The risk arising out of the use or performance of the scripts and documentation stays with you. In no event shall SolarWinds or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the scripts or documentation.