harry.douglass | 23 Aug 02:04

Out of the office


I will be out of the office starting  08/22/2008 and will not return until
08/27/2008.

I will respond to your message upon my return.

The contents of this email are the property of PNC. If it was not addressed to you, you have no legal right to
read it. If you think you received it in error, please notify the sender. Do not forward or copy without
permission of the sender. This message may contain an advertisement of a product or service and thus may
constitute a commercial electronic mail message under US Law. The postal address for PNC is 249 Fifth
Avenue, Pittsburgh, PA 15222. If you do not wish to receive any additional advertising or promotional
messages from PNC at this e-mail address, click here to unsubscribe.
https://pnc.p.delivery.net/m/u/pnc/uni/p.asp By unsubscribing to this message, you will be
unsubscribed from all advertising or promotional messages from PNC. Removing your e-mail address from
this mailing 
 list will not affect your subscription to alerts, e-newsletters or account servicing e-mails.

Milind Lad | 25 Aug 07:05

IsDebugEnabled = false

Hi All,

I am new to log4net. I would to integrate this dll into my application. So I
have done the following steps:
1. I have added log4net dll into my application.
2. Then insert this code
	protected static readonly ILog objLog = LogManager.GetLogger(
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 
	
	private showLog()
		{
			if (objLog.IsDebugEnabled) objLog.Error("While
save");
		}	

I hope these are the only steps to integrate log4net into application. But
on load I get IsDebugEnabled FALSE.
So it is difficult to write log.

Please help me!!

Thanks in advance

Regards,
Milind Lad.

Dean Fiala | 25 Aug 13:17
Favicon

RE: IsDebugEnabled = false

You need to configure log4net for the application first.  To tell it what to
log and where to log it.

http://logging.apache.org/log4net/release/manual/configuration.html

The XmlConfigurator lets you use an XML file to set up the appenders you
want to use.  It can also be set up to automaticall change your log settings
when the file is updated.  Very handy.

HTH,

Dean

-----Original Message-----
From: Milind Lad [mailto:mlad <at> vitalhealthsoftware.com] 
Sent: Monday, August 25, 2008 1:05 AM
To: 'Log4NET User'
Subject: IsDebugEnabled = false

Hi All,

I am new to log4net. I would to integrate this dll into my application. So I
have done the following steps:
1. I have added log4net dll into my application.
2. Then insert this code
	protected static readonly ILog objLog = LogManager.GetLogger(
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 
	
	private showLog()
		{
(Continue reading)

Walden H. Leverich | 25 Aug 15:31

RE: IsDebugEnabled = false

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 <at> TechSoftInc.com
http://www.TechSoftInc.com

Quiquid latine dictum sit altum viditur.
(Whatever is said in Latin seems profound.)

Daniel Williams | 25 Aug 15:51

Re: IsDebugEnabled = false

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" ?>
<configuration>

  <configSections>
    <section name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler,
        log4net" />
  </configSections>

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

    <root>
      <level value="ALL" />
      <appender-ref ref="ConsoleAppender" />
(Continue reading)


Gmane