You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by pa...@firstenergycorp.com on 2004/06/11 19:27:20 UTC

Appender question

Hello,

I've been able to get FileAppender and RollingFileAppender to work fine but
I'm having trouble with the ASPNetTraceAppender and ConsoleAppender.

If I step thru the code in debug mode the IsDebugEnabled method returns
True and it looks like it's executing the logging code but I'm not seeing
any output.

My understanding was that the ConsoleAppender's output would show up in the
Output window in Visual Studio and that the ASPNetTraceAppender's output
would show up at the bottom of the web page.


I'm hoping that someone else may see what I've overlooked.

Here's a snippet from the code-behind of the web form


    Private Shared ReadOnly logHttp As ILog =
LogManager.GetLogger("HttpTraceAppender")
    Private Shared ReadOnly logConsole As ILog =
LogManager.GetLogger("ConsoleAppender")
. . .
    If logConsole.IsDebugEnabled Then logConsole.Debug("Console log
message")
    If logHttp.IsDebugEnabled Then logHttp.Debug("ASPNet TraceAppender log
message")

Here's a snippet from Web.config file:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<!-- Register a section handler for the log4net section -->
<configSections>
  <section name="log4net" type
="System.Configuration.IgnoreSectionHandler"/>
</configSections>
<log4net debug="true">
  <appender name="HttpTraceAppender" type
="log4net.Appender.ASPNetTraceAppender" >
    <layout type="log4net.Layout.PatternLayout">
      <param name="ConversionPattern" value="%d [%t] %-5p %c [%x] - %m%n"
/>
    </layout>
  </appender>
  <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
    <layout type="log4net.Layout.PatternLayout">
      <param name="ConversionPattern" value="%d [%t] %-5p %c [%x] - %m%n"
/>
    </layout>
  </appender>
  <root>
    <level value="DEBUG" />
      <appender-ref ref="LogFileAppender" />
      <appender-ref ref="ConsoleAppender" />
      <appender-ref ref="HttpTraceAppender" />
      <appender-ref ref="RollingLogFileAppender" />
  </root>
</log4net>
 .  .  .


Thanks in advance for any help.

David.



-----------------------------------------
The information contained in this message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately, and delete the original message.