Re: Configuration system enhancement
François Dumont <francois.cppdevs <at> free.fr>
2008-10-06 19:37:43 GMT
Well, I have looked at test cases and haven't found what I am trying to
do. In fact I simply would like to know if you have ever considered
adopting the .Net 2.0 ConfigurationSection system as for the moment
log4net only use the IConfigurationSectionHandler. In a number of
situations the ConfigurationSection would be more convenient. Here are 2
use cases where I could have advantage of it:
- application specific log file:
We are developing Windows services that can be instantiated numerous
times, each service instance having its own name. All services are using
the same log4net configuration file and we prefer to have all services
log to the same 'logs' folder. So the problem is to specialize the log
file name for each service. We do so thanks to an environment variable
that each process has to set at startup containing the service name, the
file name in the log4net config file contains a %ENV_VAR% that is
automatically replaced when log4net starts.
- Custom appender with non serializable fields:
We have a custom appender to perform asynchronous log. This appender
creates for the moment its own thread to work but I would prefer to have
the application creates it and assign it to the log4net appender. The
only solution I found so far is to have some kind of thread singleton
instance in the global scope of the application and then have the
appender retrieve it at construction.
You see in both situation I have to rely on a global storage which is a
design I always try to avoid because of the thread safety or maintenance
problems that comes with it. The following configuration would be much
(Continue reading)