<div dir="ltr">I finally got time to try it out.<div style>You were right, I forgot the full path in <span style="font-family:'courier new',monospace;font-size:13px">fileNamePattern</span>.</div><div style>It works now.</div>

<div style>Thanks!</div><div style><br></div><div style>Jonas</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, May 3, 2013 at 7:56 AM, Tony Trinh <span dir="ltr"><<a href="mailto:tony19@gmail.com" target="_blank">tony19@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Jonas,<div><br></div><div>In your logback.xml, the <font face="courier new, monospace"><fileNamePattern></font> 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 <span style="font-family:'courier new',monospace"><fileNamePattern></span> with the same leading path you gave in <font face="courier new, monospace"><file></font>.</div>



<div><br></div><div>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.</div>



<div><br></div><div><div><font face="courier new, monospace"><span style="white-space:pre-wrap">  </span><appender name="filelog" class="ch.qos.logback.core.rolling.RollingFileAppender"></font></div>



<div><font face="courier new, monospace"><span style="white-space:pre-wrap">              </span><file><b style="background-color:rgb(207,226,243)">${LOG_DIR}/</b>log.log</file></font></div><div><font face="courier new, monospace"><span style="white-space:pre-wrap">              </span><encoder></font></div>



<div><font face="courier new, monospace"><span style="white-space:pre-wrap">                      </span><pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern></font></div><div><font face="courier new, monospace"><span style="white-space:pre-wrap">         </span></encoder></font></div>



<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace"><span style="white-space:pre-wrap">            </span><rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"></font></div>



<div><font face="courier new, monospace"><span style="white-space:pre-wrap">                      </span><!-- daily rollover --></font></div><div><font face="courier new, monospace"><span style="white-space:pre-wrap">                   </span><fileNamePattern><b style="background-color:rgb(207,226,243)">${</b><b style="background-color:rgb(207,226,243)">LOG_DIR}/</b>log.%d{HH-mm-ss}.log</fileNamePattern></font></div>



<div><font face="courier new, monospace"><span style="white-space:pre-wrap">                      </span><!-- keep 30 days' worth of history --></font></div><div><font face="courier new, monospace"><span style="white-space:pre-wrap">                       </span><maxHistory>30</maxHistory></font></div>



<div><font face="courier new, monospace"><span style="white-space:pre-wrap">                      </span><cleanHistoryOnStart>true</cleanHistoryOnStart></font></div><div><font face="courier new, monospace"><span style="white-space:pre-wrap">             </span></rollingPolicy></font></div>



<div><font face="courier new, monospace"><span style="white-space:pre-wrap">      </span></appender></font></div></div><div><br></div><div>For future reference, you can troubleshoot rollover issues by turning on debugging with the "debug" attribute for <configuration>:<br>



</div><div><br></div><div><font face="courier new, monospace">    <configuration debug="true"></font></div><div><font face="courier new, monospace">       ...</font></div><div><font face="courier new, monospace">    </configuration></font></div>



<div><br></div><div>OR run this command from an Android terminal (e.g., via adb shell), and restart your app:</div><div><br></div><div>    <font face="courier new, monospace">$ setprop logback.debug true</font></div>

<div><br></div><div>When debugging is enabled, the rollover is verbose, as seen in logcat (this is the output with your original logback.xml):</div><div><br></div><div><div><font face="courier new, monospace">05-03 05:25:43.428: I/com.example.MainActivity(1567): hello world</font></div>



<div><font face="courier new, monospace">05-03 05:25:43.830: I/com.example.MainActivity(1567): hello world</font></div><div><font face="courier new, monospace">05-03 05:25:44.226: I/com.example.MainActivity(1567): hello world</font></div>



<div><font face="courier new, monospace">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</font></div>



<div><font face="courier new, monospace">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]</font></div><div>


<font face="courier new, monospace" color="#ff0000">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].</font></div>



<div><font face="courier new, monospace" color="#ff0000">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.</font></div>



<div><font face="courier new, monospace" color="#ff0000">05-03 05:25:44.266: I/System.out(1567): 05:25:44,267 |-WARN in c.q.l.co.rolling.helper.RenameUtil - See also <a href="http://logback.qos.ch/codes.html#renamingError" target="_blank">http://logback.qos.ch/codes.html#renamingError</a></font></div>



<div><br></div><div><br></div><div>Hope that helps,</div><div>Tony</div><div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Thu, May 2, 2013 at 1:04 AM, Jonas Schmid <span dir="ltr"><<a href="mailto:jonas.schmid@gmail.com" target="_blank">jonas.schmid@gmail.com</a>></span> wrote:<br>



</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Hi there,<br><div class="gmail_quote"><div dir="ltr"><div><br></div><div>

I am trying to use the time based rolling configuration for my android app.</div>

<div><br></div><div>I got my configuration from the doc (<a href="http://logback.qos.ch/manual/appenders.html#TimeBasedRollingPolicy" target="_blank">http://logback.qos.ch/manual/appenders.html#TimeBasedRollingPolicy</a>) but it does not seem to work on my app.</div>






<div><br></div><div>Please find enclosed my config file.</div><div><br></div><div>The file does not roll and everything goes to log.log.</div><div><br></div><div>To try it out I changed the date on my phone. I took care of killing the app before doing so.</div>






<div>I also set the time to 23h59 then launched my app and waited, but it did not work either.</div><div><br></div><div>What did I do wrong?</div><div>Thanks</div><span><font color="#888888"><span><font color="#888888"><div>



<br></div>

<div>Jonas</div>
</font></span></font></span></div>
</div><br></div>
<br></div></div>_______________________________________________<br>
Logback-user mailing list<br>
<a href="mailto:Logback-user@qos.ch" target="_blank">Logback-user@qos.ch</a><br>
<a href="http://mailman.qos.ch/mailman/listinfo/logback-user" target="_blank">http://mailman.qos.ch/mailman/listinfo/logback-user</a><br></blockquote></div><br></div>
<br>_______________________________________________<br>
Logback-user mailing list<br>
<a href="mailto:Logback-user@qos.ch">Logback-user@qos.ch</a><br>
<a href="http://mailman.qos.ch/mailman/listinfo/logback-user" target="_blank">http://mailman.qos.ch/mailman/listinfo/logback-user</a><br></blockquote></div><br></div>