
On Fri, Jun 28, 2013 at 12:19 PM, Tony Trinh <tony19@gmail.com> wrote:
Then, in your logback.xml:
Just noticed the file paths in my example were not absolute paths, which are required in logback-android. I've corrected the example below. <configuration>
<property name="LOG_DIR" value="/data/data/com.example/files/logback" />
<appender name="FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${LOG_DIR}/logFile.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <!-- hourly rollover --> <fileNamePattern>${LOG_DIR}/logFile.%d{yyyy-MM-dd_HH}.log</ fileNamePattern>
<!-- make that every 4 hours --> <timeBasedFileNamingAndTriggeringPolicy class="com.example.MyTimeBasedTriggeringPolicy"> <timeMultiple>4</timeMultiple> </timeBasedFileNamingAndTriggeringPolicy> </rollingPolicy>
<encoder> <pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern> </encoder> </appender>
<root level="DEBUG"> <appender-ref ref="FILE" /> </root> </configuration>