logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bender Heri" <HBen...@Ergonomics.ch>
Subject Re: Enhanced FileAppender
Date Mon, 09 Oct 2006 08:03:53 GMT
Hi all

After having thought during the weekend I think Patrick's suggestion of Decorator Pattern
would be the easiest way to go. 

Pro:
- The enhancement applies to all FileAppender
- There is no need to touch the code of the existing file appenders. They work the same way
as until now (except the append property is always true)

Contra:
- A new feature in xml config would be needed (see below)
- Since property config is no more supported the MultiFileAppender would only be available
with xml configurations

A proposal for configuring the MultiFileAppender with new tag "classparam":

    <appender name="Multi_Appender" class="org.apache.log4j.MultiFileAppender">
        <classparam name="fileAppender" class="org.apache.log4j.DailyRollingFileAppender">
            <param name="file" value="myLog.log"/>
            <param name="DatePattern" value="yyyy-MM-dd"/>        
            ...
        </classparam> 
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d{dd.MM.yy HH:mm:ss.SSS} %m%n"/>
        </layout>
        <classparam name="fileNamePolicy" class="my.company.LogFileNameBuilder"/>
    </appender>

The idea is that a param of a configured item can be a class as well, with own properties.
The configurator would recursively instantiate the enclosed classes and then call the setFileAppender()
of the MultiFileAppender.

Heri


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message