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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to