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

Nicolas Giraud (JIRA) noreply-jira at qos.ch
Fri Oct 31 09:07:21 CET 2008


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