RE: RE: Newbie help

Nicko Cadell <[email protected]> Mon, 9 Feb 2004 09:12:05 -0000
Newsgroups gmane.comp.windows.dotnet.log4net.user
Message-ID <[email protected]>
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C3EEEC.C95E996C
Content-Type: text/plain

(I will try that again!)
 
Matthew,
 
If you go down the road of using the static readonly variables you do make a
small performance gain, but only if you make a lot of logging calls, however
you do give up a number of features, principally the ability to at runtime
reconfigure the logging levels.
 
The static booleans cache the value of the IsXXXEnabled properties,
therefore the properties have to know their ultimate value before you cache
them. As you point out you need to load the configuration file before you
cache the values.
 
You can either load the configuration programmatically using the
DOMConfigurator.Configure() methods, or you can use the
DOMConfiguratorAttribute. From your code sample it does not appear as if you
are using the DOMConfiguratorAttribute. When you use the
DOMConfiguratorAttribute the configuration file is loaded when the first
call is made to LogManager.GetLogger().
 
Try adding a DOMConfiguratorAttribute to your assembly:
[assembly: DOMConfigurator()]
 
Nicko

-----Original Message-----
From: Matthew Griffore [mailto:[email protected]] 
Sent: 04 February 2004 22:27
To: '[email protected]'
Subject: [Log4net-users] RE: Newbie help



I've had some limited success with Log4Net and I hope for someone to clear
this up for me.

I am able to log to different appenders without any problem. However, from
the sample code in the manual it states that the fastest way to determine if
logging is enabled I should use a private static readonly member variable.
Not a problem right? Wrong. I can't seem to read the log object's Boolean
values until I configure the logger.

Am I missing something? Any help would be greatly appreciated. Also, does
anyone know if a WMI appender will ever be supported with log4net? Thanks.

Here is the code I'm working with:

CONFIG FILE:

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

        <configSections>

                <section name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler,log4net-net-1.0"/>

        </configSections>

        <log4net>

                <logger name="testApp.Logging">

                        <level value="DEBUG"/>

                </logger>

                <root>

                        <level value="WARN"/>

                        <appender-ref ref=" EventLogAppender "/>

                </root>

                <appender name="EventLogAppender"
type="log4net.Appender.EventLogAppender" >

                        <param name="Threshold" value="ERROR"/>

                        <param name="ApplicationName"
value="Log4NetSample"/>

                        <layout type="log4net.Layout.PatternLayout">

                                <param name="ConversionPattern" value="%d
[%t] %-5p %c [%x] - %m%n"/>

                        </layout>

                </appender>

        </log4net>

</configuration>

C# CODE:

using System;

using System.IO;

using log4net;

public class driver

{

        // Is this how I should be initializing the log object? With the
name of my logger?

        private static readonly ILog log =
LogManager.GetLogger("testApp.Logging");

        // These Boolean values are not available until I read the config
file???

        private static readonly bool isDebugEnabled = log.IsDebugEnabled;

        private static readonly bool isErrorEnabled = log.IsErrorEnabled;

        private static readonly bool isFatalEnabled = log.IsFatalEnabled;

        private static readonly bool isInfoEnabled = log.IsInfoEnabled;

        private static readonly bool isIsWarnEnabled = log.IsWarnEnabled;

        static void Main(string[] args)

        {

                // Why do I have to do the following line of code? Should
not the config file be read automatically?

                log4net.Config.DOMConfigurator.Configure(new
FileInfo("conLog4NetSample.exe.config"));

                logInfo("Start of main");

        }

}

BM__MailAutoSigMatthew Griffore | Application Integration | Union Gas

Web Application Specialist / Integration Specialist
Union Gas ~ 800.571.8446:2682 ~  <mailto:[email protected]>
[email protected]


------_=_NextPart_001_01C3EEEC.C95E996C
Content-Type: text/html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<TITLE>Message</TITLE>

<META content="MSHTML 6.00.2800.1276" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=218401009-09022004>(I 
will try that again!)</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2>Matthew,</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2>If you go down the road of using the 
static readonly variables you do make a small </FONT><FONT face=Arial 
color=#0000ff size=2>performance gain, but only if you make a lot of logging 
calls, however you do give up a </FONT><FONT face=Arial color=#0000ff 
size=2>number of features, principally the ability to at runtime reconfigure the 
logging levels.</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2>The static booleans cache the value 
of the IsXXXEnabled properties, therefore the </FONT><FONT face=Arial 
color=#0000ff size=2>properties have to know their ultimate value before you 
cache them. As you point out you </FONT><FONT face=Arial color=#0000ff 
size=2>need to load the configuration file before you cache the 
values.</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2>You can either load the configuration 
programmatically using the </FONT><FONT face=Arial color=#0000ff 
size=2>DOMConfigurator.Configure() methods, or you can use the 
DOMConfiguratorAttribute. From </FONT><FONT face=Arial color=#0000ff size=2>your 
code sample it does not appear as if you are using the DOMConfiguratorAttribute. 
When </FONT><FONT face=Arial color=#0000ff size=2>you use the 
DOMConfiguratorAttribute the configuration file is loaded when the first call 
</FONT><FONT face=Arial color=#0000ff size=2>is made to 
LogManager.GetLogger().</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2>Try adding a DOMConfiguratorAttribute 
to your assembly:</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2>[assembly: 
DOMConfigurator()]</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2>Nicko</FONT></DIV>
<BLOCKQUOTE dir=ltr 
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
  <DIV></DIV>
  <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT 
  face=Tahoma size=2>-----Original Message-----<BR><B>From:</B> Matthew Griffore 
  [mailto:[email protected]] <BR><B>Sent:</B> 04 February 2004 
  22:27<BR><B>To:</B> '[email protected]'<BR><B>Subject:</B> 
  [Log4net-users] RE: Newbie help<BR><BR></FONT></DIV>
  <P align=left><FONT face="Courier New" size=2>I've had some limited success 
  with Log4Net and I hope for someone to clear this up for me.</FONT></P>
  <P align=left><FONT face="Courier New" size=2>I am able to log to different 
  appenders without any problem. However, from the sample code in the manual it 
  states that the fastest way to determine if logging is enabled I should use a 
  private static readonly member variable. Not a problem right? Wrong. I can't 
  seem to read the log object's Boolean values until I configure the 
  logger.</FONT></P>
  <P align=left><FONT face="Courier New" size=2>Am I missing something? Any help 
  would be greatly appreciated. Also, does anyone know if a WMI appender will 
  ever be supported with log4net? Thanks.</FONT></P>
  <P align=left><FONT face="Courier New" size=2>Here is the code I'm working 
  with:</FONT></P>
  <P align=left><B><FONT face="Courier New" size=2>CONFIG FILE:</FONT></B></P>
  <P align=left><FONT face="Courier New" color=#0000ff size=2>&lt;?</FONT><FONT 
  face="Courier New" color=#800000 size=2>xml</FONT><FONT face="Courier New" 
  color=#ff00ff size=2></FONT> <FONT face="Courier New" color=#ff0000 
  size=2>version</FONT><FONT face="Courier New" color=#0000ff 
  size=2>="1.0"</FONT><FONT face="Courier New" color=#ff00ff size=2></FONT> 
  <FONT face="Courier New" color=#ff0000 size=2>encoding</FONT><FONT 
  face="Courier New" color=#0000ff size=2>="utf-8"</FONT><FONT 
  face="Courier New" color=#ff00ff size=2></FONT> <FONT face="Courier New" 
  color=#0000ff size=2>?&gt;</FONT></P>
  <P align=left><FONT face="Courier New" color=#0000ff size=2>&lt;</FONT><FONT 
  face="Courier New" color=#800000 size=2>configuration</FONT><FONT 
  face="Courier New" color=#0000ff size=2>&gt;</FONT></P>
  <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
  face="Courier New" color=#0000ff size=2>&lt;</FONT><FONT face="Courier New" 
  color=#800000 size=2>configSections</FONT><FONT face="Courier New" 
  color=#0000ff size=2>&gt;</FONT></P>
  <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face="Courier New" 
  color=#0000ff size=2>&lt;</FONT><FONT face="Courier New" color=#800000 
  size=2>section</FONT><FONT face="Courier New" color=#ff00ff size=2></FONT> 
  <FONT face="Courier New" color=#ff0000 size=2>name</FONT><FONT 
  face="Courier New" color=#0000ff size=2>="log4net"</FONT><FONT 
  face="Courier New" color=#ff00ff size=2></FONT> <FONT face="Courier New" 
  color=#ff0000 size=2>type</FONT><FONT face="Courier New" color=#0000ff 
  size=2>="log4net.Config.Log4NetConfigurationSectionHandler,log4net-net-1.0"/&gt;</FONT></P>
  <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
  face="Courier New" color=#0000ff size=2>&lt;/</FONT><FONT face="Courier New" 
  color=#800000 size=2>configSections</FONT><FONT face="Courier New" 
  color=#0000ff size=2>&gt;</FONT></P>
  <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
  face="Courier New" color=#0000ff size=2>&lt;</FONT><FONT face="Courier New" 
  color=#800000 size=2>log4net</FONT><FONT face="Courier New" color=#0000ff 
  size=2>&gt;</FONT></P>
  <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face="Courier New" 
  color=#0000ff size=2>&lt;</FONT><FONT face="Courier New" color=#800000 
  size=2>logger</FONT><FONT face="Courier New" color=#ff00ff size=2></FONT> 
  <FONT face="Courier New" color=#ff0000 size=2>name</FONT><FONT 
  face="Courier New" color=#0000ff size=2>="testApp.Logging"&gt;</FONT></P>
  <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face="Courier New" 
  color=#0000ff size=2>&lt;</FONT><FONT face="Courier New" color=#800000 
  size=2>level</FONT><FONT face="Courier New" color=#ff00ff size=2></FONT> <FONT 
  face="Courier New" color=#ff0000 size=2>value</FONT><FONT face="Courier New" 
  color=#0000ff size=2>="DEBUG"/&gt;</FONT></P>
  <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face="Courier New" 
  color=#0000ff size=2>&lt;/</FONT><FONT face="Courier New" color=#800000 
  size=2>logger</FONT><FONT face="Courier New" color=#0000ff 
  size=2>&gt;</FONT></P>
  <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face="Courier New" 
  color=#0000ff size=2>&lt;</FONT><FONT face="Courier New" color=#800000 
  size=2>root</FONT><FONT face="Courier New" color=#0000ff 
size=2>&gt;</FONT></P>
  <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face="Courier New" 
  color=#0000ff size=2>&lt;</FONT><FONT face="Courier New" color=#800000 
  size=2>level</FONT><FONT face="Courier New" color=#ff00ff size=2></FONT> <FONT 
  face="Courier New" color=#ff0000 size=2>value</FONT><FONT face="Courier New" 
  color=#0000ff size=2>="WARN"/&gt;</FONT></P>
  <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face="Courier New" 
  color=#0000ff size=2>&lt;</FONT><FONT face="Courier New" color=#800000 
  size=2>appender-ref</FONT><FONT face="Courier New" color=#ff00ff 
  size=2></FONT> <FONT face="Courier New" color=#ff0000 size=2>ref</FONT><FONT 
  face="Courier New" color=#0000ff size=2>=" EventLogAppender "/&gt;</FONT></P>
  <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face="Courier New" 
  color=#0000ff size=2>&lt;/</FONT><FONT face="Courier New" color=#800000 
  size=2>root</FONT><FONT face="Courier New" color=#0000ff 
size=2>&gt;</FONT></P>
  <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face="Courier New" 
  color=#0000ff size=2>&lt;</FONT><FONT face="Courier New" color=#800000 
  size=2>appender</FONT><FONT face="Courier New" color=#ff00ff size=2></FONT> 
  <FONT face="Courier New" color=#ff0000 size=2>name</FONT><FONT 
  face="Courier New" color=#0000ff size=2>="EventLogAppender"</FONT><FONT 
  face="Courier New" color=#ff00ff size=2></FONT> <FONT face="Courier New" 
  color=#ff0000 size=2>type</FONT><FONT face="Courier New" color=#0000ff 
  size=2>="log4net.Appender.EventLogAppender"</FONT><FONT face="Courier New" 
  color=#ff00ff size=2></FONT> <FONT face="Courier New" color=#0000ff 
  size=2>&gt;</FONT></P>
  <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face="Courier New" 
  color=#0000ff size=2>&lt;</FONT><FONT face="Courier New" color=#800000 
  size=2>param</FONT><FONT face="Courier New" color=#ff00ff size=2></FONT> <FONT 
  face="Courier New" color=#ff0000 size=2>name</FONT><FONT face="Courier New" 
  color=#0000ff size=2>="Threshold"</FONT><FONT face="Courier New" color=#ff00ff 
  size=2></FONT> <FONT face="Courier New" color=#ff0000 size=2>value</FONT><FONT 
  face="Courier New" color=#0000ff size=2>="ERROR"/&gt;</FONT></P>
  <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face="Courier New" 
  color=#0000ff size=2>&lt;</FONT><FONT face="Courier New" color=#800000 
  size=2>param</FONT><FONT face="Courier New" color=#ff00ff size=2></FONT> <FONT 
  face="Courier New" color=#ff0000 size=2>name</FONT><FONT face="Courier New" 
  color=#0000ff size=2>="ApplicationName"</FONT><FONT face="Courier New" 
  color=#ff00ff size=2></FONT> <FONT face="Courier New" color=#ff0000 
  size=2>value</FONT><FONT face="Courier New" color=#0000ff 
  size=2>="Log4NetSample"/&gt;</FONT></P>
  <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face="Courier New" 
  color=#0000ff size=2>&lt;</FONT><FONT face="Courier New" color=#800000 
  size=2>layout</FONT><FONT face="Courier New" color=#ff00ff size=2></FONT> 
  <FONT face="Courier New" color=#ff0000 size=2>type</FONT><FONT 
  face="Courier New" color=#0000ff 
  size=2>="log4net.Layout.PatternLayout"&gt;</FONT></P>
  <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face="Courier New" 
  color=#0000ff size=2>&lt;</FONT><FONT face="Courier New" color=#800000 
  size=2>param</FONT><FONT face="Courier New" color=#ff00ff size=2></FONT> <FONT 
  face="Courier New" color=#ff0000 size=2>name</FONT><FONT face="Courier New" 
  color=#0000ff size=2>="ConversionPattern"</FONT><FONT face="Courier New" 
  color=#ff00ff size=2></FONT> <FONT face="Courier New" color=#ff0000 
  size=2>value</FONT><FONT face="Courier New" color=#0000ff size=2>="%d [%t] 
  %-5p %c [%x] - %m%n"/&gt;</FONT></P>
  <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face="Courier New" 
  color=#0000ff size=2>&lt;/</FONT><FONT face="Courier New" color=#800000 
  size=2>layout</FONT><FONT face="Courier New" color=#0000ff 
  size=2>&gt;</FONT></P>
  <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face="Courier New" 
  color=#0000ff size=2>&lt;/</FONT><FONT face="Courier New" color=#800000 
  size=2>appender</FONT><FONT face="Courier New" color=#0000ff 
  size=2>&gt;</FONT></P>
  <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
  face="Courier New" color=#0000ff size=2>&lt;/</FONT><FONT face="Courier New" 
  color=#800000 size=2>log4net</FONT><FONT face="Courier New" color=#0000ff 
  size=2>&gt;</FONT></P>
  <P align=left><FONT face="Courier New" color=#0000ff size=2>&lt;/</FONT><FONT 
  face="Courier New" color=#800000 size=2>configuration</FONT><FONT 
  face="Courier New" color=#0000ff size=2>&gt;</FONT></P>
  <P align=left><B><FONT face="Courier New" size=2>C# CODE:</FONT></B></P>
  <P align=left><FONT face="Courier New" color=#0000ff size=2>using</FONT><FONT 
  face="Courier New" size=2> System;</FONT></P>
  <P align=left><FONT face="Courier New" color=#0000ff size=2>using</FONT><FONT 
  face="Courier New" size=2> System.IO;</FONT></P>
  <P align=left><FONT face="Courier New" color=#0000ff size=2>using</FONT><FONT 
  face="Courier New" size=2> log4net;</FONT></P>
  <P align=left><FONT face="Courier New" color=#0000ff size=2>public</FONT><FONT 
  face="Courier New" size=2></FONT> <FONT face="Courier New" color=#0000ff 
  size=2>class</FONT><FONT face="Courier New" size=2> driver</FONT></P>
  <P align=left><FONT face="Courier New" size=2>{</FONT></P>
  <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
  face="Courier New" size=2>// Is this how I should be initializing the log 
  object? With the name of my logger?</FONT></P>
  <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
  face="Courier New" color=#0000ff size=2>private</FONT><FONT face="Courier New" 
  size=2></FONT> <FONT face="Courier New" color=#0000ff 
  size=2>static</FONT><FONT face="Courier New" size=2></FONT> <FONT 
  face="Courier New" color=#0000ff size=2>readonly</FONT><FONT 
  face="Courier New" size=2> ILog log = 
  LogManager.GetLogger("testApp.Logging");</FONT></P>
  <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
  face="Courier New" size=2>// These Boolean values are not available until I 
  read the config file???</FONT></P>
  <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
  face="Courier New" color=#0000ff size=2>private</FONT><FONT face="Courier New" 
  size=2></FONT> <FONT face="Courier New" color=#0000ff 
  size=2>static</FONT><FONT face="Courier New" size=2></FONT> <FONT 
  face="Courier New" color=#0000ff size=2>readonly</FONT><FONT 
  face="Courier New" size=2> bool isDebugEnabled = 
log.IsDebugEnabled;</FONT></P>
  <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
  face="Courier New" color=#0000ff size=2>private</FONT><FONT face="Courier New" 
  size=2></FONT> <FONT face="Courier New" color=#0000ff 
  size=2>static</FONT><FONT face="Courier New" size=2></FONT> <FONT 
  face="Courier New" color=#0000ff size=2>readonly</FONT><FONT 
  face="Courier New" size=2></FONT> <FONT face="Courier New" size=2>bool 
  isErrorEnabled = log.IsErrorEnabled;</FONT></P>
  <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
  face="Courier New" color=#0000ff size=2>private</FONT><FONT face="Courier New" 
  size=2></FONT> <FONT face="Courier New" color=#0000ff 
  size=2>static</FONT><FONT face="Courier New" size=2></FONT> <FONT 
  face="Courier New" color=#0000ff size=2>readonly</FONT><FONT 
  face="Courier New" size=2> bool isFatalEnabled = 
log.IsFatalEnabled;</FONT></P>
  <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
  face="Courier New" color=#0000ff size=2>private</FONT><FONT face="Courier New" 
  size=2></FONT> <FONT face="Courier New" color=#0000ff 
  size=2>static</FONT><FONT face="Courier New" size=2></FONT> <FONT 
  face="Courier New" color=#0000ff size=2>readonly</FONT><FONT 
  face="Courier New" size=2> bool isInfoEnabled = log.IsInfoEnabled;</FONT></P>
  <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
  face="Courier New" color=#0000ff size=2>private</FONT><FONT face="Courier New" 
  size=2></FONT> <FONT face="Courier New" color=#0000ff 
  size=2>static</FONT><FONT face="Courier New" size=2></FONT> <FONT 
  face="Courier New" color=#0000ff size=2>readonly</FONT><FONT 
  face="Courier New" size=2> bool isIsWarnEnabled = 
log.IsWarnEnabled;</FONT></P>
  <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
  face="Courier New" color=#0000ff size=2>static</FONT><FONT face="Courier New" 
  size=2></FONT> <FONT face="Courier New" color=#0000ff size=2>void</FONT><FONT 
  face="Courier New" size=2> Main(</FONT><FONT face="Courier New" color=#0000ff 
  size=2>string</FONT><FONT face="Courier New" size=2>[] args)</FONT></P>
  <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
  face="Courier New" size=2>{</FONT></P>
  <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face="Courier New" size=2>// 
  Why do I have to do the following line of code? Should not the config file be 
  read automatically?</FONT></P>
  <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face="Courier New" 
  size=2>log4net.Config.DOMConfigurator.Configure(</FONT><FONT 
  face="Courier New" color=#0000ff size=2>new</FONT><FONT face="Courier New" 
  size=2> FileInfo("conLog4NetSample.exe.config"));</FONT></P>
  <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face="Courier New" 
  size=2>logInfo("Start of main");</FONT></P>
  <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
  face="Courier New" size=2>}</FONT></P>
  <P align=left><FONT face="Courier New" size=2>}</FONT></P>
  <P align=left><B><I></I></B><A name=_MailAutoSig><B><I><FONT face=Arial 
  color=#0000ff size=2>Matthew Griffore | Application Integration | Union 
  Gas</FONT></I></B></A></P>
  <P align=left><B><FONT face=Arial color=#ff0000 size=2>Web Application 
  Specialist / Integration Specialist</FONT></B><BR><B></B><B><FONT face=Arial 
  color=#999999 size=2>Union Gas ~ 800.571.8446:2682 ~</FONT></B> <A 
  href="mailto:[email protected]"><B></B><B><U><FONT face=Arial 
  color=#999999 
  size=2>[email protected]</FONT></U></B></A><B></B><B></B></P></BLOCKQUOTE></BODY></HTML>

------_=_NextPart_001_01C3EEEC.C95E996C--


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn