What is the root logger in log4net
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" />
<a开发者_Python百科ppender-ref ref="RollingLogFileAppender" />
</root>
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).
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.
精彩评论