Dear Mr. Cadell!

I want to use the DataAppender of log4net to save log-information in a 
Database of my Smart Device Application.

My dataTable looks as follows:

Date       nvarchar        50
UserName           nvarchar        50   
ClassName          nvarchar        50   
Method     nvarchar        50   
Description        nvarchar        50   
Parameters  nvarchar   200      
rowguid uniqueidentifier        16      

My app.config file looks as follows:


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

<!-- .NET application configuration file

     The .NET Compact Framework does not support application configuration 
files,
     but log4net supports using configuration files with similar names and 
structure,
     to store the log4net configuration.
 -->

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

<appender name="ADONetAppender_SqlServer" 
type="log4net.Appender.ADONetAppender" >
              <param name="ConnectionType" 
value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0,

Culture=neutral, PublicKeyToken=b77a5c561934e089" />
              <param name="ConnectionString" value="workstation 
id=ACHATSCHITZ;packet size=4096;user id=sa;pwd=sa;data 
source=achatschitz;persist security info=False;initial catalog=HelpDesk" />
<commandText value="INSERT INTO Instrumentation 
([Date],[UserName],[ClassName],[Method],[Description],[Parameters]) VALUES 
         (@log_date, @thread, @log_level, @logger, @message, @exception)" />
      <parameter>
         <parameterName value="@log_date" />
         <dbType value="DateTime" />
         <layout type="log4net.Layout.RawTimeStampLayout" />
      </parameter>
      <parameter>
         <parameterName value="@thread" />
         <dbType value="String" />
         <size value="50" />
         <layout type="log4net.Layout.PatternLayout">
            <conversionPattern value="%t" />
         </layout>
      </parameter>
      <parameter>
         <parameterName value="@log_level" />
         <dbType value="String" />
         <size value="50" />
         <layout type="log4net.Layout.PatternLayout">
            <conversionPattern value="%p" />
         </layout>
      </parameter>
      <parameter>
         <parameterName value="@logger" />
         <dbType value="String" />
         <size value="50" />
         <layout type="log4net.Layout.PatternLayout">
            <conversionPattern value="%c" />
         </layout>
      </parameter>
      <parameter>
         <parameterName value="@message" />
         <dbType value="String" />
         <size value="50" />
         <layout type="log4net.Layout.PatternLayout">
            <conversionPattern value="%m" />
         </layout>
      </parameter>
      <parameter>
         <parameterName value="@exception" />
         <dbType value="String" />
         <size value="200" />
         <layout type="log4net.Layout.ExceptionLayout" />
      </parameter>
   </appender>
   <root>
      <level value="DEBUG" />
      <appender-ref ref="ADONetAppender" />
   </root>

        </log4net>

</configuration>
 
And in my application I wrote the following code:

protected static readonly ILog log = LogManager.GetLogger(typeof(Login));
log4net.Config.DOMConfigurator.Configure();

and in the method where I want to log information I add the following:

log.Debug("The program got here!");
LogManager.Shutdown();

But when I execute my application and invoke this method, nothing happens. 
Can you please help me what went wrong here?

Best Regards

--------------------------
Patrick Achatschitz, Bakk.
Fasangasse 8/3
1030 Vienna
Austria
 
Mobile: 01 650 270 8819

-----Urspr�ngliche Nachricht-----
Von: Nicko Cadell [mailto:[EMAIL PROTECTED] 
Gesendet: Montag, 29. November 2004 16:48
An: Log4NET User
Betreff: RE: RollingFileAppender does not log to the file

Marco,

The debug output looks like everything is working as it should.
Can you confirm that the output file
"C:\Inetpub\wwwroot\amt\log\AMTLogger.log" is being created, and is
empty.

Also I was wondering where the "2004-11-26 10:33:11,527 [2112]
test.Application_Start() - Test aus Application_Start" message cam from,
it looks like it is output through the A_Console appender, however I
don't think that the ASP.NET service should have a Console attached
(unless you are hosting ASP.NET in your own Console App).

What is the configuration file you are using?

Cheers,
Nicko

> -----Original Message-----
> From: Marco Herrn [mailto:[EMAIL PROTECTED] 
> Sent: 26 November 2004 15:40
> To: [email protected]
> Subject: RollingFileAppender does not log to the file
> 
> Hi,
> 
> I have a problem with using log4net in an ASP.NET 
> application. The debug output of log4net says that it loads 
> the log4net config file correctly and also opens the log file 
> for reading. But nothing is written to the file. The debug 
> output is appended to this mail.
> Any ideas what can be the problem here?
> 
> Regards
> Marco
> 

Reply via email to