Hi Jonas,
In your logback.xml, the <fileNamePattern> should specify an absolute path where your application has write permissions, or else it will assume the root directory is the parent directory of the destination file (which is unlikely to be writeable). If you want the rollover files to be in the same directory as your active log file, prefix the <fileNamePattern> with the same leading path you gave in <file>.
In the following example (based on your original logback.xml), the log rolls every second in the same directory as the active file. I successfully tested this with an Android app that logged a message every 400ms.
<appender name="filelog" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_DIR}/log.log</file>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover -->
<fileNamePattern>${LOG_DIR}/log.%d{HH-mm-ss}.log</fileNamePattern>
<!-- keep 30 days' worth of history -->
<maxHistory>30</maxHistory>
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
</appender>
For future reference, you can troubleshoot rollover issues by turning on debugging with the "debug" attribute for <configuration>:
<configuration debug="true">
...
</configuration>
OR run this command from an Android terminal (e.g., via adb shell), and restart your app:
$ setprop logback.debug true
When debugging is enabled, the rollover is verbose, as seen in logcat (this is the output with your original logback.xml):
05-03 05:25:43.428: I/com.example.MainActivity(1567): hello world
05-03 05:25:43.830: I/com.example.MainActivity(1567): hello world
05-03 05:25:44.226: I/com.example.MainActivity(1567): hello world
05-03 05:25:44.236: I/System.out(1567): 05:25:44,235 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Elapsed period: Fri May 03 05:25:43 GMT 2013
05-03 05:25:44.246: I/System.out(1567): 05:25:44,243 |-INFO in c.q.l.co.rolling.helper.RenameUtil - Renaming file [/sdcard/logback/log.log] to [log.05-25-43.log]
05-03 05:25:44.246: I/System.out(1567): 05:25:44,251 |-WARN in c.q.l.co.rolling.helper.RenameUtil - Failed to rename file [/sdcard/logback/log.log] to [log.05-25-43.log].
05-03 05:25:44.266: I/System.out(1567): 05:25:44,259 |-WARN in c.q.l.co.rolling.helper.RenameUtil - Please consider leaving the [file] option of RollingFileAppender empty.
Hope that helps,
Tony