[ 
https://issues.apache.org/jira/browse/LOG4NET-368?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ralph Goers updated LOG4NET-368:
--------------------------------

LOG4NET is now dormant.  

> PatternString "properties" in config file
> -----------------------------------------
>
>                 Key: LOG4NET-368
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-368
>             Project: Log4net
>          Issue Type: Improvement
>          Components: Other
>            Reporter: Casul User
>            Priority: Minor
>
> The PatternString has many built-in conversion patterns but none of them can 
> use properties defined in the configuration file. The PatternString should 
> also help to prevent copy paste errors and use the DRY pattern also in the 
> config file. If you have many log files and they log in the same path, you 
> would like to define the log path only once. If you want to change the log 
> path, you would like to change it only in one place and not in many places.
> Perhaps the most interesting converter is the "property" converter but you 
> can't define global properties in the configuration file. The log4net global 
> properties are nice but they are embedded in code and compiled with the 
> application.
> My suggestions are: Define log4net global properties in the configuration 
> file:
> <log4net>
>  <globalproperties>
>   <add key="logpath" value="c:\logs\myapplication\" />
>  </globalproperties>
>  <appender>
>   <file value="%properties{logpath}log.txt" />
>  </appender>
> </log4net>
> Or add an appsettings converter to the PatternString:
> <appSettings>
>  <add key="logpath" value="c:\logs\myapplication\" />
> </appSettings>
> <log4net>
>  <appender>
>   <file value="%appsettings{logpath}log.txt" />
>  </appender>
> </log4net>
> There are also other cases where configuring part of the log path globally is 
> useful, most of the time you have different environments: test, staging, 
> production, demo, etc. and some times you have different type of the same 
> environment: test-configuration1, test-configuration2, etc. So the ability to 
> build the log file path from properties defined in the config file is an 
> added value in those cases.
> In those cases I have to set the properties only once in one place and I 
> haven't to change the log file path of every logger, this would prevent 
> errors like logger logging in the wrong place and it would simplify the 
> deploy and configuration process.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to