logging-log4net-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Bodewig (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LOG4NET-325) Scan repository properties in PropertyPatternConverter
Date Sun, 03 Jun 2012 08:12:23 GMT

    [ https://issues.apache.org/jira/browse/LOG4NET-325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13288114#comment-13288114
] 

Stefan Bodewig commented on LOG4NET-325:
----------------------------------------

IIUC you don't want the pattern converter (which deals with logging events) but the parser
for configuration to deal with properties, right?

The specific case of file names could be dealt with inside the FileAppender class where the
file name could be expanded during the ActivateOptions method.

For a more general solution you'd have to modify the configurators (XmlConfigurator at least)
and parsing the configuration would have to be done in two phases.  The first one would only
read the properties and the second one would have to apply them.  We'd probably need to define
our own syntax of expanding properties to prevent %property{} being replaced in legitimate
logging patterns.
                
> Scan repository properties in PropertyPatternConverter
> ------------------------------------------------------
>
>                 Key: LOG4NET-325
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-325
>             Project: Log4net
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 1.2.12
>            Reporter: Michal Sznajder
>
> With https://issues.apache.org/jira/browse/LOG4NET-53 log4net got possibility to configure
properties from config file.
> It would be nice to see that PropertyPatternConverter supports this improvement. This
would simplify configuring 
> multiple FileAppenders by only once specifying where log should be stored, eg.:
> <?xml version="1.0" encoding="utf-8" ?>
> <log4net>
>     <property>   
>         <key value="ROOT_LOG_DIR" />
>         <value value="c:\logs" />
>     </property>
>   <appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
>     <file type="log4net.Util.PatternString" value="%property{ROOT_LOG_DIR}\logs.txt"
/>
>   </appender>
>   <appender name="RollingFile2" type="log4net.Appender.RollingFileAppender">
>     <file type="log4net.Util.PatternString" value="%property{ROOT_LOG_DIR}\logs2.txt"
/>
>   </appender>
>   <root>
>     <level value="ALL" />
>     <appender-ref ref="RollingFile" />
>     <appender-ref ref="RollingFile2" />
>   </root>
> </log4net>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message