Note that there are some explanatory texts on larger screens.

plurals
  1. POLogback-android and ACRA
    text
    copied!<p>I'm trying to set up my app so I can write logs using <a href="http://tony19.github.com/logback-android/" rel="nofollow">logback-android</a>, and then send them to Google Docs using <a href="http://acra.ch/" rel="nofollow">ACRA</a>. I think this is possible but the one issue I have, is where to write the logs.</p> <p>Both libraries need a hard-coded filename, so I can't use <code>getStorageDirectory()</code>. So, my first question is, where do the logs get written if you don't specify a full path? Do I have to specify a full path and hardcode it to <code>/data/data/com.example/...</code>?</p> <p>Here's my configuration:</p> <pre><code>&lt;!-- Logback configuration. --&gt; &lt;logback&gt; &lt;configuration&gt; &lt;appender name="FILE" class="ch.qos.logback.core.FileAppender" &gt; &lt;file&gt;applog.log&lt;/file&gt; &lt;encoder&gt; &lt;pattern&gt;[%method] %msg%n&lt;/pattern&gt; &lt;/encoder&gt; &lt;/appender&gt; &lt;appender name="LOGCAT" class="ch.qos.logback.classic.android.LogcatAppender" &gt; &lt;tagEncoder&gt; &lt;pattern&gt;%logger{0}&lt;/pattern&gt; &lt;/tagEncoder&gt; &lt;encoder&gt; &lt;pattern&gt;[%method] %msg%n&lt;/pattern&gt; &lt;/encoder&gt; &lt;/appender&gt; &lt;root level="debug" &gt; &lt;appender-ref ref="FILE" /&gt; &lt;appender-ref ref="LOGCAT" /&gt; &lt;/root&gt; &lt;/configuration&gt; &lt;/logback&gt; </code></pre> <p>And for acra:</p> <pre><code>@ReportsCrashes(formKey = "dDB4dVRlTjVWa05T..........................", applicationLogFile = "applog.log", applicationLogFileLines = 150) </code></pre> <p>But this gives errors like the following, so clearly I do need an absolute path. What should I use?</p> <pre><code>java.io.FileNotFoundException: /applog.log: open failed: EROFS (Read-only file system) </code></pre> <p>Final, slightly unrelated question, I want to be able to print the object address, something like [%object :: %method] which would show [MyActivity@33c0d9d :: onCreate] or something similar. Is there any way to do that?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload