logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Williams" <dlw...@gmail.com>
Subject Re: IsDebugEnabled = false
Date Mon, 25 Aug 2008 13:51:39 GMT
Also, you need to configure the logging system.  A simple way to do it
is to put this into your assemblyinfo.cs file:

[assembly: log4net.Config.XmlConfigurator(ConfigFile="log4net.config",
Watch = true)]

Then make an actual config file called log4net.config and make sure
it's in your app's working folder.  There are many examples out on the
web.  Here is one that will output to the console if you're running
the app from there:

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

    <section name="log4net"
        log4net" />

    <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
      <layout type="log4net.Layout.PatternLayout">
        <param name="ConversionPattern" value="%d [%t] %-5p [%x] - %m%n" />

      <level value="ALL" />
      <appender-ref ref="ConsoleAppender" />


Daniel Williams

On Mon, Aug 25, 2008 at 7:31 AM, Walden H. Leverich
<WaldenL@techsoftinc.com> wrote:
> As Dean pointed out, check that you're actually starting log4net. Also
> though, in your example you're checking if the Debug level is enabled,
> but you're logging an error. While this isn't "wrong" per-se, it's not
> common. I would expect that you'd check Debug if you were logging debug,
> and check Error if you were logging error. Then again, you may be doing
> something slightly different.
> -Walden
> --
> Walden H Leverich III
> Tech Software
> (516) 627-3800 x3051
> WaldenL@TechSoftInc.com
> http://www.TechSoftInc.com
> Quiquid latine dictum sit altum viditur.
> (Whatever is said in Latin seems profound.)

View raw message