22

I don't quite understand what the main functionality for root logger as shown in following section is. What is the difference from other loggers?

<root>
  <level value="WARN" />
  <appender-ref ref="RollingLogFileAppender" />
</root>
Craig
  • 6,869
  • 3
  • 32
  • 52
Ricky
  • 34,377
  • 39
  • 91
  • 131

2 Answers2

15

I think the log4net documentation explains this quite nicely:

Loggers are organized in hierarchies. E.g.: The logger Foo.Bar is child of the logger Foo. This way the loggers create a tree and the root logger is simply the root of that tree (in the example Foo is a child of the root logger).

This hiearchy allows for some interesting configuration applications (e.g. disable/enable logging for an entire sub system of your application).

Dan Atkinson
  • 11,391
  • 14
  • 81
  • 114
Stefan Egli
  • 17,398
  • 3
  • 54
  • 75
3

The Root Logger can hold a list of appenders and settings (typically just the log level) used when logging.

Check this link for more details about the Root Logger with Log4net.

Jason
  • 2,503
  • 3
  • 38
  • 46