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:[EMAIL PROTECTED] 
> 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 <[EMAIL PROTECTED]> 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
> > 
> 
> 
> 

Reply via email to