logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Georg Jansen" <Georg.Jan...@Faktnet.com>
Subject RE: Can't Get Logging Working in Web Service
Date Sat, 09 Jun 2007 11:47:04 GMT
Kevin,

 

 

>From what I can see, you have a syntax error in the SqlCommandText in
AdoNetAppender

 

INSERT INTO LogDetail (MessageID, Source, Details, LogSeverityID,
CreatedDate) 

VALUES ( '7d32ea24-289c-48d7-9037-7c3caa75a87c', 'ASEBP.QueryService ' (<<<<
' was missing in your command text

, @message, @log_level, @log_date )

 

I would also check (or double check) that the user account which the web
server is running under, has the necessary privileges to the files you are
using, i.e. the log4net config file
(C:\TFSProjects\Services\QueryService\QueryService\Bin\log4net.config )and
the C:\tmp\log4net.txt.

 

 

Best regards

Georg

 <http://www.l4ndash.com/> http://www.l4ndash.com - Log4net Dashboard

 

 

 

From: Kevin Parkinson [mailto:kevin.parkinson@quercussolutions.com] 
Sent: 8. juni 2007 16:57
To: log4net-user@logging.apache.org
Subject: Can't Get Logging Working in Web Service

 

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\Bin\l
og4net.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