Hello,

I would like to suggest the following changes to DailyRollingFileAppender.  If 
this is not the appropriate forum for this email, please direct me to the 
proper channels as I'm new to Log4j. ;)

Feature:

        -       Allow date pattern to be embedded anywhere in the file name 
[not just appended to the end].

        -       Allow easy addition of custom placeholders in file name.

Rationale:

        -       Preserve file extensions in Windows [so that I can use the same 
associated program to open both the pending log and the archived logs]

        -       Use same log4j.properties to output to different files 
depending on run-time state

        -       Solves http://www.mail-archive.com/[EMAIL 
PROTECTED]/msg06750.html using simpler syntax

Use cases:

1.      Typical usage.

        Given properties:
                log4j.appender.F        = 
org.apache.log4j.DailyRollingFileAppender
                log4j.appender.F.File   = trace%d.log
                log4j.appender.F.DatePattern = '.'yyyyMMdd

        Output goes to
                trace.log
                trace.20071111.log
                trace.20071112.log

2.      For reverse compatibility, "%d" is implicitly appended if omitted.

        Given:
                log4j.appender.F        = 
org.apache.log4j.DailyRollingFileAppender
                log4j.appender.F.File   = trace.log
                log4j.appender.F.DatePattern = '.'yyyyMMdd

        Output goes to
                trace.log
                trace.log.20071111
                trace.log.20071112

3.      Custom placeholder illustration.  Output to different locations 
depending on the process ID.

        Given:
                log4j.appender.F        = 
custom.DailyRollingFileAppenderSubclass
                log4j.appender.F.File   = trace%p%d.log
                log4j.appender.F.DatePattern = '.'yyyyMMdd
        where
                %p = process ID

        Output goes to
                trace.log
                trace.2342.20071111.log
                trace.2342.20071112.log

Thanks for your consideration.

- Howard

Attachment: DailyRollingFileAppender.java.patch
Description: DailyRollingFileAppender.java.patch

Attachment: DailyRollingFileAppender.java
Description: DailyRollingFileAppender.java

Attachment: DailyRollingFileAppender.java.orig-1.2.15.bak
Description: DailyRollingFileAppender.java.orig-1.2.15.bak

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to