[logback-dev] [JIRA] Resolved: (LBCORE-54) FileAppender to support FileNamePattern option

Ceki Gulcu (JIRA) noreply-jira at qos.ch
Mon Oct 27 23:08:21 CET 2008


     [ http://jira.qos.ch/browse/LBCORE-54?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ceki Gulcu resolved LBCORE-54.
------------------------------

    Fix Version/s: 0.9.10
       Resolution: Fixed

Given that as of version 0.9.10, logback creates missing directories, I think that the following configuration file will do what you want. Note that you do not need the "File" property. It will be guessed by the "FileNamePattern". 

<configuration>
   <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
  
   <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
     <FileNamePattern>logFile.%d{yyyy/MM/dd}.log</FileNamePattern>
   </rollingPolicy>

   <layout class="ch.qos.logback.classic.PatternLayout">
     <Pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</Pattern>
   </layout>
 </appender> 

 <root level="debug">
   <appender-ref ref="FILE" />
 </root>
</configuration>

If you append ".zip" or ".gz" to the end of  FileNamePattern, then rolled over files will be compressed as well. Note that the current log file will be in plain text (not compressed) for convenient access. Example:

 <FileNamePattern>logFile.%d{yyyy/MM/dd}.log.zip</FileNamePattern>

I am closing this issue as "Resolved".  If the above explanation does not meet your needs, please create a new issue which will not carry the confusing baggage of the present issue (LBCORE-54).

> FileAppender to support FileNamePattern option
> ----------------------------------------------
>
>                 Key: LBCORE-54
>                 URL: http://jira.qos.ch/browse/LBCORE-54
>             Project: logback-core
>          Issue Type: Improvement
>          Components: Appender
>         Environment: Any
>            Reporter: Chris Cheshire
>            Assignee: Logback dev list
>             Fix For: 0.9.10
>
>
> It would be very useful if the base FileAppender supported the FileNamePattern option, the same as the rolling policy classes do for the RollingFileAppender. This will allow for log files to be created directly into a date based directory in the format of "logs/yyyy/MM/dd/appname.log".

-- 
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