logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chase Rogers" <crog...@nextit.com>
Subject trying somthing simple, and it fails
Date Fri, 17 Dec 2004 22:06:54 GMT
All I am trying to do is make a fileAppender.  
I just want to know how to use the log4net tool, but the documentation
does'nt help me.
 
The problem is simple: the file I specify to be 'written' to does not
get anything.  I tied the log.Info method to a button click, but when i
click, nothing happens.  
And I KNOW the button click is working.
 
Am I just leaving out somthing, or am I going about it all wrong?
 
My xml:
<?xml version="1.0" encoding="utf-8" ?> 

<log4net>

<appender name="fileAppender" type="log4net.Appender.FileAppender">

<param name="File" value="C:\logFile.txt"/>

<param name="AppendToFile" value="true"/>

<param name="ImmediateFlush" value="true" />

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

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

</layout>

</appender>

<root>

<level value="INFO"/>

<appender-ref ref="fileAppender"/>

</root>

</log4net>

 

And my code contains the following:

static log4net.ILog log = log4net.LogManager.GetLogger("TestLog");

log4net.Config.DOMConfigurator.ConfigureAndWatch(new
System.IO.FileInfo("..\\..\\log4net.xml"));

log.Info("Constructor");

 

private void DoIt(object sender, EventArgs e)  // A button click calls
this method

{

log.Info("Do It was pushed");

}

private void Form1_Closing(object sender,
System.ComponentModel.CancelEventArgs e) // Closing the app calls this
method

{

log4net.LogManager.Shutdown();

}

 


Mime
View raw message