You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-dev@logging.apache.org by Ron Grabowski <ro...@yahoo.com> on 2005/12/13 19:17:21 UTC

RE: Config.AppSettingsConfigurator

Mark Womack from the log4j project recommended we include the appender
node that was used to generate the output as the header property on the
appender. In other words, the output file from using:

 <appSettings>
  <add key="log4net.Output.File" value="log.txt" />
 </appSettings>

would be:

"
## This file was generated using the following log4net appender:
##
## <appender>
##  ...
## </appender>
##
INFO 2005-12-13 - Hello
INFO 2005-12-13 - World
INFO 2005-12-13 - Foo
"

While we want to make it easy for new people to use log4net, we also
want people to migrate over to a proper configuration file at some
point. I thought it was a good idea.

- Ron

--- Nicko Cadell <ni...@neoworks.com> wrote:

> As far as I can see log4j is not really investing a lot of time in
> their
> property file configuration stuff. They now have a new XML
> configurator
> (Joran Configurator).
> 
> I can see your point about getting something working out of the box.
> If
> we do something like this then is must work very simply and reliably
> but
> it should not really be something that people end up using in
> production.
> 
> Maybe we should just have a single AppSettings property that gives
> you a
> FileAppender writing to a path you specify? We fix the Layout and all
> the FileAppender options.
> 
> <appSettings>
> <add key="log4net.ItJustWorks.File" value="log.txt" />
> </appSettings>
> 
> equivalent to:
> 
> <appender name="FileAppender" type="log4net.Appender.FileAppender">
>   <file value="log.txt" />
>   <appendToFile value="true" />
>   <layout type="log4net.Layout.PatternLayout" value="%d [%t] %-5p %c
> -
> %m%n" />
> </appender>
> 
> <root>
>   <level value="ALL" />
>   <appender-ref name="FileAppender" />
> </root>
> 
> Ok maybe we don't call it 'log4net.ItJustWorks.File'.
> 
> Alternatively, rather than introduce a new simpler configuration
> system
> maybe we need to look at the issues our users are having with the
> current system and give them better documentation, examples, and more
> helpful error feedback.
> 
> Or we do both.
> 
> Nicko
> 
> > -----Original Message-----
> > From: Ron Grabowski [mailto:rongrabowski@yahoo.com] 
> > Sent: 06 October 2005 22:17
> > To: Log4NET Dev
> > Subject: Re: Config.AppSettingsConfigurator
> > 
> > I think this is similiar to what log4j does in terms of using 
> > property files for its configuration.
> > 
> > --- Ron Grabowski <ro...@yahoo.com> wrote:
> > 
> > > I've heard people complain that log4net is too difficult to
> setup...
> > > 
> > > Perhaps we could add a new configurator that would setup a 
> > very basic 
> > > log4net environment that uses a single FileAppender and 
> > just the root 
> > > logger. The values would be settable via add nodes:
> > > 
> > > <appSettings>
> > > <add key="log4net.AppSettingsConfigurator.File" value="log.txt"
> /> 
> > > <add key="log4net.AppSettingsConfigurator.AppendToFile" 
> > value="false"
> > > />
> > > <add key="log4net.AppSettingsConfigurator.Layout" value="%d %l
> %m%n"
> > > />
> > > </appSettings>
> > > 
> > > log4net would be configured using this:
> > > 
> > >  log4net.Config.AppSettingsConfigurator.Configure();
> > > 
> > > That would allow a complete functioning log4net setup in 
> > just 5 lines.
> > > 
> > > A more advanced setup might be:
> > > 
> > >  <appSettings>
> > >   <add
> > >    key="log4net.AppSettingsConfigurator"
> > >    value="UdpAppender" />
> > >   <add
> > >    key="log4net.AppSettingsConfigurator.RemoteAddress
> > >    value=" value="127.0.0.1" />
> > >   <add
> > >    key="log4net.AppSettingsConfigurator.RemotePort"
> > >    value="8080" />
> > >   <add
> > >    key="log4net.AppSettingsConfigurator.LayoutType"
> > >    value="log4net.Layout.XmlLayoutSchemaLog4j" />
> > >   </appSettings>
> > > 
> > > I don't think we should support any more configurability past
> this 
> > > point. If the user wants/needs more flexibility they should use a
> 
> > > log4net section in their App.Config or a seperate 
> > log4net.config file.
> > > 
> > > There's nothing more frustrating when working with a new
> component 
> > > than not being able to get the most basic setup working.
> > > 
> > > Comments?
> > > 
> > > - Ron
> > > 
> > 
> > 
> > 
>