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