Configuring centralized logging from Android apps

Papertrail can accept logs from any Android application using either of the following methods.


1. Add the following to the app’s Gradle dependencies list:

compile 'org.slf4j:slf4j-api:1.7.13' 
compile 'com.github.tony19:logback-android-core:1.1.1-4' 
compile 'com.github.tony19:logback-android-classic:1.1.1-4' 
compile ('com.papertrailapp:logback-syslog4j:1.0.0'){ 
  exclude group: 'ch.qos.logback' 

2. Use the following configuration file, replacing logsN & XXXXX with the details shown under Log Destinations in Papertrail. YOUR_APP will appear as the program name in the event viewer.

  <appender name="syslog-tls" class="com.papertrailapp.logback.Syslog4jAppender"> 
    <layout class="ch.qos.logback.classic.PatternLayout">
      <pattern>%d{MMM dd HH:mm:ss} Android YOUR_APP: %-5level %logger{35} %m%n</pattern>

    <syslogConfig class=""> 

  <appender name="async" class="ch.qos.logback.classic.AsyncAppender"> 
    <appender-ref ref="syslog-tls" /> 

  <root level="INFO"> 
    <appender-ref ref="async" /> 


Use logback-android and then follow Papertrail’s typical logback setup.

The article Logging from iOS and OS X apps has a few tips for making the most of Papertrail for logs from mobile devices.

Other methods

If neither logback-syslog4j or logback-android are suitable for your app: