logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chase Rogers" <crog...@nextit.com>
Subject RE: trying somthing simple, and it fails
Date Sat, 18 Dec 2004 00:08:26 GMT
Good call!

-----Original Message-----
From: Graham Innocent [mailto:gi@parthenoncomputing.com] 
Sent: Friday, December 17, 2004 2:51 PM
To: Log4NET User
Subject: Re: trying somthing simple, and it fails


Hi,

A couple of things to double check:-

1) You have a hard-coded file reference : "..\\..\\log4net.xml"

Are you certain that this corresponds to where your .xml file actually
is ?

2)  Are you sure that "C:\logFile.txt" is writable by your app ?

Cheers,
   Graham Innocent


Chase Rogers wrote:
> 
> 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