[logback-dev] [JIRA] Commented: (LBCORE-68) Add a pattern resolver to <file> property of FileAppnder

Neil Lott (JIRA) noreply-jira at qos.ch
Tue Feb 3 17:59:47 CET 2009

    [ http://jira.qos.ch/browse/LBCORE-68?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11030#action_11030 ] 

Neil Lott commented on LBCORE-68:

I agree with Nicolas and feel this would be a valuable addition to logback.

My suggestion would be that any pattern allowed in the filepattern (e.g. addition of a timezone) should be allowed in the initial filename.



> Add a pattern resolver to <file> property of FileAppnder
> --------------------------------------------------------
>                 Key: LBCORE-68
>                 URL: http://jira.qos.ch/browse/LBCORE-68
>             Project: logback-core
>          Issue Type: New Feature
>          Components: Appender, Joran
>    Affects Versions: 0.9.11
>         Environment: Ubuntu 8.04, J2SE 6
>            Reporter: Nicolas Giraud
>            Assignee: Logback dev list
> Following discussion on the mailing list, it would be very convenient to be able to use patterns in the filename of a FileAppender. My initial expectation was to be able to do something like:
> <appender name="myFileAppender" class="ch.qos.logback.core.FileAppender">
>         <file>${logFolder}/SomePrefix.%d.someExt</file>
>         [...]
> </appender> 
> where %d would be substituted by the current date. However Ralph Goers, when replying to my question on the mailing list, suggested a more flexibl approach:
> <appender name="myFileAppender" class="ch.qos.logback.core.FileAppender">
>     <File resolver="com.mycorp.logback.MyPatternResolver">someName.%{host}.%{datetime}.log</File>
>     [...]
> </appender>
> with MyPatternResolver implementing an interface like:
> package ch.qos.logback.core.pattern;
> public interface Resolver {
>     String resolve(String pattern);
> }
> Providing a default implementation allowing to generate timestamp, use system properties, would be nice too.
> Currently this can be done programmatically, but it would be most convenient to have the possibility to do this using the Joran configurator.
> Best regards,
> Nicolas

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the logback-dev mailing list