Peter Remec
Lurker
I'm trying to add some log files for my Android app using Android Logback. It logs to a logcat while logging to file fails.
Here's my initialization - logback.xml:
I also tried to write log files to a sd card (with WRITE_EXTERNAL_STORAGE permission) - no luck. Also there's no error in a logcat that could give me some hint.
Any idea how to solve my problem? Is there any other permission that needs to be added?
Using slf4j-1.7.21, logback-android-core-1.1.1-6 and logback-android-classic-1.1.1-6. I'm running my app on Sony Xperia Z with Android KitKat (4.4.4)
Here's my initialization - logback.xml:
HTML:
<configuration>
<property name="LOG_DIR" value="/data/data/my.package/files" />
<appender name="logcat" class="ch.qos.logback.classic.android.LogcatAppender">
<encoder>
<pattern>%msg</pattern>
</encoder>
</appender>
<appender name="TraceLog" class="ch.qos.logback.core.FileAppender">
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>TRACE</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
<file>${LOG_DIR}/app_trace.log</file>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<appender name="DebugLog" class="ch.qos.logback.core.FileAppender">
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>DEBUG</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
<file>${LOG_DIR}/app_debug.log</file>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<logger name="my.package.A" level="TRACE">
<appender-ref ref="TraceLog" />
</logger>
<logger name="my.package.B" level="DEBUG">
<appender-ref ref="DebugLog" />
</logger>
<root level="INFO">
<appender-ref ref="logcat" />
</root>
</configuration>
I also tried to write log files to a sd card (with WRITE_EXTERNAL_STORAGE permission) - no luck. Also there's no error in a logcat that could give me some hint.
Any idea how to solve my problem? Is there any other permission that needs to be added?
Using slf4j-1.7.21, logback-android-core-1.1.1-6 and logback-android-classic-1.1.1-6. I'm running my app on Sony Xperia Z with Android KitKat (4.4.4)