logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Parkinson" <kevin.parkin...@quercussolutions.com>
Subject Can't Get Logging Working in Web Service
Date Fri, 08 Jun 2007 14:56:34 GMT
Hello everyone:

 

                I have tried to enable logging and even the internal
debugging of log4net in my web service but I cannot seem to get it to
work. 

 

Here is my log4net.config file:

 

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

<configuration>                

<configSections>

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

    </configSections>

                

    <log4net>

 

                                <appender
name="AdoNetAppender_SqlServer" type="log4net.Appender.AdoNetAppender">

                                                <connectionType
value="System.Data.SqlClient.SqlConnection, System.Data,
Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

                                                <connectionString
value="data source=.;initial catalog=Logging;integrated security=True"
/>

                                                <commandText
value="INSERT INTO LogDetail (MessageID, Source, Details, LogSeverityID,
CreatedDate) VALUES ( '7d32ea24-289c-48d7-9037-7c3caa75a87c',
'ASEBP.QueryService, @message, @log_level, @log_date )" />

                                                <parameter>

 
<parameterName value="@log_date" />

                                                                <dbType
value="DateTime" />

                                                                <layout
type="log4net.Layout.PatternLayout" value="%date{yyyy'-'MM'-'dd
HH':'mm':'ss'.'fff}" />

                                                </parameter>

                                                <parameter>

 
<parameterName value="@log_level" />

                                                                <dbType
value="String" />

                                                                <size
value="50" />

                                                                <layout
type="log4net.Layout.PatternLayout" value="%level" />

                                                </parameter>

                                                <parameter>

 
<parameterName value="@message" />

                                                                <dbType
value="String" />

                                                                <size
value="4000" />

                                                                <layout
type="log4net.Layout.PatternLayout" value="%message" />

                                                </parameter>

                                                <!--<parameter>

 
<parameterName value="@messageID" />

                                                                <dbType
value="String" />

                                                                <size
value="10" />

                                                                <layout
type="log4net.Layout.PatternLayout"
value="7d32ea24-289c-48d7-9037-7c3caa75a87c" />

                                                </parameter>

                                                <parameter>

 
<parameterName value="@source" />

                                                                <dbType
value="String" />

                                                                <size
value="10" />

                                                                <layout
type="log4net.Layout.PatternLayout" value="ASEBP.QueryService" />

                                                </parameter>-->

                                </appender>

                                

        <root>

            <level value="DEBUG" />

                                                <appender-ref
ref="AdoNetAppender_SqlServer" />                                    

        </root>

 

                </log4net>

</configuration>

 

And here is what I put in the web.config:

 

Within configuration:

 

<system.diagnostics>

<trace autoflush="true">

                                <listeners>

                                                <add
name="textWriterTraceListener"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="C:\tmp\log4net.txt"/>

                                </listeners>

                </trace>

</system.diagnostics>

 

And in appSettings:

 

<add key="log4net.Internal.Debug" value="true"/>

 

Then in my web service:

 

Just inside the class definition:

private static readonly ILog _logger =
LogManager.GetLogger(typeof(QueryService));

 

then in my service method:

 

log4net.Config.XmlConfigurator.Configure(new
System.IO.FileInfo(@"C:\TFSProjects\Services\QueryService\QueryService\B
in\log4net.config"));

log4net.Util.LogLog.InternalDebugging = true;

 

_logger.Info("Some Message"); 

 

Can anyone see any issues here? Thanks for any help in advance.

 

 

 

 


Mime
View raw message