logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tomas Ramirez <tom...@windward.net>
Subject RE: no log file generated
Date Wed, 24 Feb 2010 00:19:16 GMT
I've done some investigating, and here's what I noticed.  My web parts (in my dev environment)
are capable of creating and writing to the file that I specified in the RollingFileAppender,
so it shouldn't be any problem with permission to that file.  That makes me think that it
must be a problem with log4net getting the configuration information in the first place. 
But I'm just theorizing, in hopes that this will help someone help me figure out what's going
on. 

- Tomas


-----Original Message-----
From: Tomas Ramirez [mailto:tomasr@windward.net] 
Sent: Tuesday, February 23, 2010 3:02 PM
To: log4net-user@logging.apache.org
Subject: no log file generated

Hi, I'm trying to use log4net in sharepoint web parts, but no log file is being generated.
 Is there something I'm forgetting to do?  Here's what I've got:

I've got a web part that calls:
	log4net.Config.XmlConfigurator.Configure();
	ILog log = LogManager.GetLogger(typeof(DataDefinitionWebPart));
	log.Fatal(String.Format("{0}\n{1}\n{2}", ex.Message, ex.Source, ex.StackTrace));

Then in my web config, I have a log4net section in configSections
	<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"
/>

And I here's what I have in the log4net section:
  <log4net>
    <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
      <layout type="log4net.Layout.PatternLayout">
        <param name="ConversionPattern" value="[%t] ac.server %-5p %c - %m%n" />
      </layout>
    </appender>
    <appender name="TraceAppender" type="log4net.Appender.TraceAppender">
      <layout type="log4net.Layout.PatternLayout">
        <param name="ConversionPattern" value="[%t] ac.server %-5p %c - %m%n" />
      </layout>
    </appender>
    <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
      <!-- This is where your log is saved -->
      <param name="File" value="F:\arrowlog.txt" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <datePattern value=".yyyy-MM-dd" />
      <layout type="log4net.Layout.PatternLayout">
        <param name="ConversionPattern" value="%d [%t] ac.server %-5p %c - %m%n" />
      </layout>
    </appender>
    <root>
      <level value="DEBUG" />
      <appender-ref ref="ConsoleAppender" />
      <appender-ref ref="TraceAppender" />
      <appender-ref ref="RollingFileAppender" />
    </root>
  </log4net>

Thanks!
- Tomas



Mime
View raw message