androidpapertrail-app

papertrail set up


I can't believe I am having to ask this but I have no idea where to turn. I have Googled loads but not come up with anything.

I am looking to use papertrail instead of bugsnag for logging on my android application.

I have been given some code (seen below) to add to a configuration file. I have no idea where to put this file, the manifest? a new file? in the gradle bits?

Any help appreciated.

<configuration> 
  <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>
    </layout>

    <syslogConfig class="org.productivity.java.syslog4j.impl.net.tcp.ssl.SSLTCPNetSyslogConfig"> 
      <host>logsN.papertrailapp.com</host> 
      <port>XXXXX</port> 
      <sendLocalName>false</sendLocalName>
      <sendLocalTimestamp>false</sendLocalTimestamp> 
      <maxMessageLength>128000</maxMessageLength> 
    </syslogConfig> 
  </appender>

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

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

Solution

  • I had the same issue (and I'd say Papertrail's Android setup instructions are seriously poor)

    Turns out

    1. You first need to setup either logback-sys4j or logback-android

    (I chose logback-android - instructions here: http://tony19.github.io/logback-android/).

    1. This shows that you need to add logback.xml under /app/src/main/assets/logback.xml

    2. Then update host and port in your logback.xml (You can find these on Papertrail dashboard Settings > Log Destinations)

    Then you will start getting logs on the Papertrail dashboard

    Warning: When you choose Selected application only in logcat, your logs won't show because Papertrail logs don't contain the application name (unless you configure otherwise) by default