Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 27th, 2006, 11:41 AM
Registered User
 
Join Date: Mar 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default log4net.appender

I am not able to log event messages into my sql server database. Everything is correct, it compiles well and gives no error, still nothing is updated to my database, i have created the table I am using AdoNetAppender & my config file looks like:

<configuration>

    <configSections>
        <section name="log4net" type="System.Configuration.IgnoreSectionHandler"/>
    </configSections>

    <log4net>
        <appender name="AdoNetAppender" 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=SQLSVR;initial catalog=RB;user id=sa;password=sa" />
              <commandText value="INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Message]) VALUES (@log_date, @thread, @log_level, @logger, @message)" />
                <parameter>
                    <parameterName value="@log_date" />
                    <dbType value="DateTime" />
                    <layout type="log4net.Layout.RawTimeStampLayout" />
                </parameter>
                <parameter>
                    <parameterName value="@thread" />
                    <dbType value="String" />
                    <size value="255" />
                    <layout type="log4net.Layout.PatternLayout">
                        <conversionPattern value="%thread" />
                    </layout>
                </parameter>
                <parameter>
                    <parameterName value="@log_level" />
                    <dbType value="String" />
                    <size value="50" />
                    <layout type="log4net.Layout.PatternLayout">
                        <conversionPattern value="%level" />
                    </layout>
                </parameter>
                <parameter>
                    <parameterName value="@logger" />
                    <dbType value="String" />
                    <size value="255" />
                    <layout type="log4net.Layout.PatternLayout">
                        <conversionPattern value="%logger" />
                    </layout>
                </parameter>
                <parameter>
                    <parameterName value="@message" />
                    <dbType value="String" />
                    <size value="4000" />
                    <layout type="log4net.Layout.PatternLayout">
                        <conversionPattern value="%message" />
                    </layout>
                </parameter>
                <parameter>
                    <parameterName value="@exception" />
                    <dbType value="String" />
                    <size value="2000" />
                    <layout type="log4net.Layout.ExceptionLayout" />
                </parameter>
        </appender>

        <logger name="client">

            <level value="DEBUG"/>

            <appender-ref ref="AdoNetAppender"/>
        </logger>
    </log4net>
</configuration>


 
Old April 14th, 2006, 06:13 AM
Registered User
 
Join Date: Mar 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hey i have done it myself, just added the buffersize n it worked perfectly fine.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Session expires at logging messages using Log4Net nadigadda .NET Framework 1.x 0 May 2nd, 2007 04:32 PM
Session expires at logging messages using Log4Net nadigadda .NET Framework 2.0 0 May 2nd, 2007 04:29 PM
Log4Net EventLog Problem prerak_v_shah C# 0 April 25th, 2006 04:22 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.