I'll take a stab at General.2: Though it's possible to organize loggers differently, the default and standard way log4net organizes loggers is hierarchically by the dots.
This works very well if you have a good, strong, assembly naming hierarchy (such as FooCorp.Project.FuncGroup.ClassName) as the logging configuration hierarchy just follows the assembly pattern. This way I can easily configure all the logging for a particular functionality group (FuncGroup in this example) using a single <logger> item in the config file. By default, sub-loggers will inherit their config (appenders, level, etc) from their parents. For Example: <logger name="Foo.Bar.Wahoo"> <level name="DEBUG"/> <appender-ref name="MyRollingFileAppender"/> </logger> <logger name="Foo.Bar.Wahoo.Blargh"> <appender-ref name="AnotherRollingFileAppender"/> </logger> In this case, Blargh will get both appenders and his level will be "DEBUG". If you wish to block inheritance (or additivity), simply set the attribute on the <logger> tag: <logger name="Foo.Bar.Wahoo.Blargh" additivity="false"> <level name="ERROR"/> <appender-ref.... </logger> Now Blargh will level ERROR and only log to one appender: AnotherRolling... -Chad -----Original Message----- From: Denis, Rich [mailto:[EMAIL PROTECTED] Sent: Monday, May 24, 2004 12:34 PM To: Log4NET User Subject: RE: Configuration Questions Let me see if I can tackle this... General ============================ 1) What is the difference between using <appender> and <logger>? Appenders are the conceptual name for outputs. There are multiple appenders like "RollingLogFile" etc. These are all configured and then referenced as an 'output' for the logger. Loggers on the other hand are what actually do the logging. 2) Is there an example somewhere for Level Inheritance? Not sure what you mean here. <Root> ============================ 1) How does <appender> and <logger> relate to the <root>? Root is the default logger. If you were not to configure an individual appender for each logger, you could just create one appender and associate it with the root logger. Appenders can be associated with either an individual logger or the root logger. Anything that is not specifically sent to a logger will be sent to the root logger. 2) What is the default level for <root> if one is not specified? I believe that default is "Debug" but I may very well be wrong here....just specify one ;) 3) <appender-ref> is implemented to reference by name. What does this buy me? Not sure what you mean by "buy you". Appender ref is how you wire up a logger to output to a particular appender. <logger> ============================ 1) Is the <name = "LoggerName"> the same as log4net.LogManager.GetLogger("LoggerName") ? Yes the name that is in the "LoggerName" attrib value is the value of the logger if you got the logger name when you created it. In a config file this is simple log4nets way of knowing what to do in regards to logging when it encounters your logger. 2) How do you log to different places within the application? What do you mean log to different places? Do you mean log to multiple outputs? If so you would configure multiple appenders and associate them to the logger using the appender-ref tag. Hope this helps. Rich -----Original Message----- From: David Elliott [mailto:[EMAIL PROTECTED] Sent: Monday, May 24, 2004 11:23 AM To: [email protected] Subject: Configuration Questions I am just starting out using Log4Net. I have looked through the .chm file and the introduction.html files and still have some questions on the items contained within the configuration file and in general. General ============================ 1) What is the difference between using <appender> and <logger>? 2) Is there an example somewhere for Level Inheritance? <Root> ============================ 1) How does <appender> and <logger> relate to the <root>? 2) What is the default level for <root> if one is not specified? 3) <appender-ref> is implemented to reference by name. What does this buy me? <logger> ============================ 1) Is the <name = "LoggerName"> the same as log4net.LogManager.GetLogger("LoggerName") ? 2) How do you log to different places within the application? Any help is appreciated. Thanks, Dave _________________________________________________________________ Stop worrying about overloading your inbox - get MSN Hotmail Extra Storage! http://join.msn.click-url.com/go/onm00200362ave/direct/01/
