logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cort Schaefer" <c...@xmission.com>
Subject RE: Strange behaviour
Date Tue, 13 Jul 2004 13:38:32 GMT
Download DebugView from www.sysinternals.com <http://www.sysinternals.com/>
, it will show you the trace messages that are output while log4net is
starting up.  When I have had problems with no logging, that usually tells
me enough information to know why.





From: David Anderson [mailto:david@dmaassociates.co.uk] 
Sent: Thursday, July 08, 2004 8:50 AM
To: log4net-user@logging.apache.org
Subject: Strange behaviour


I have just started with log4net, and am having some difficulty in 
getting things going. 
I have code: 

Imports log4net 
Imports log4net.Config 
Module Module1 

    Private log As log4net.ILog = 

    Sub Main() 

        ' Open log 
        Dim filename As String = AppDomain.CurrentDomain.BaseDirectory & 
        log4net.Config.DOMConfigurator.Configure(New IO.FileInfo(filename)) 
        log.Debug("Starting application") 
    End Sub 
End Module 

and when run I get no output file, and the config file is deleted. 
If I enable internal debugging, though, I get output file with my 
"starting application", and the config file remains. 

I assume that I am doing something wrong, but I can't see what. 

Can anyone shed light on this? 

<?xml version="1.0" encoding="utf-8" ?> 
        .NET application configuration file    
        This file must have the exact same name as your application with 
.config appended to it. 
    <!-- Register a section handler for the log4net section --> 
        <section name="log4net" 
type="System.Configuration.IgnoreSectionHandler" /> 
        <!-- To enable internal log4net logging specify the following 
appSettings key --> 
        <!-- <add key="log4net.Internal.Debug" value="true"/> --> 
    <!-- This section contains the log4net configuration settings --> 

<!-- This section contains the log4net configuration settings --> 
    <!-- Define some output appenders --> 
        <appender name="FileAppender" type="log4net.Appender.FileAppender"> 
        <param name="File" value="log-file.txt" /> 
        <param name="AppendToFile" value="true" /> 
        <layout type="log4net.Layout.PatternLayout"> 
            <param name="ConversionPattern" value="%d [%t] %-5p %c [%x] 
- %m%n" /> 
        <!-- Setup the root category, add the appenders and set the 
default priority --> 
        <level value="DEBUG" /> 
        <appender-ref ref="FileAppender" /> 

View raw message