Friday, May 18, 2012
 
The best way to analyze your logs! Minimize
 Log4Net Mail archive   

The Log4Net mailing list is a great source of information about using log4Net, in this forum we collect all the messages in the log4net user list and some selected threads from the developer list.

Subject: AdoNetAppender for SQL db issue
Prev Next
You are not authorized to post a reply.

Author Messages
nmarun

04/30/2007 7:29 PM  

Hi Log4Net developers/users,

I'm currently developing a logging mechanism for our company and I'm having
an issue with the below code - its not working!!

[code]
<appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender">
        <bufferSize value="100" />
        <threshold value="WARN" />
        <connectionType value="System.Data.SqlClient.SqlConnection, System.Data,
Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
        <connectionString value="Server=serverName;Database=Log4Net;User
ID=userID;Password=Password;Trusted_Connection=False" />
        <commandText value="INSERT INTO [Log]
([Date],[Thread],[Level],[Logger],[Message],[Exception]) VALUES
('@log_date', '@thread', '@log_level', '@logger', '@message', '@exception')"
/>
        <parameter>
                <parameterName value="@log_date" />
                <dbType value="DateTime" />
                 <layout type="log4net.Layout.PatternLayout">
                        <conversionPattern value="%d{yyyy'-'MM'-'dd HH':'mm':'ss'.'fff}" />
                 </layout>
        </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="255" />
                <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>
[/code]

I'm writing a C# web app to test this and after run the code I do not see
any inserts in the database table. Please help.

Thanks
Arun
--
View this message in context: http://www.nabble.com/AdoNetAppender-for-SQL-db-issue-tf3670908.html#a10257423
Sent from the Log4net - Users mailing list archive at Nabble.com.

nmarun

04/30/2007 8:59 PM  

I found out the error:

  --- Move the commandText line after all the parameter nodes.

Thanks
Arun

nmarun

04/30/2007 8:59 PM  

I found out the error:

  --- Move the commandText line after all the parameter nodes.

Thanks
Arun
--
View this message in context: http://www.nabble.com/AdoNetAppender-for-SQL-db-issue-tf3670908.html#a10258734
Sent from the Log4net - Users mailing list archive at Nabble.com.

You are not authorized to post a reply.
Forums > Log4Net > Log4Net Mail archive > AdoNetAppender for SQL db issue



ActiveForums 3.7

 

 

 

 

 

 

 

 

Log4Net Dashboard

Log analysis and monitoring made easy!

Log4Net Dashboard is a log viewer that can read log statements from a variety of logging output targets.

You can download a free developer version.

  

Check it out!

On the demonstration site you can try it  with live data.demo.l4ndash.com - Try Log4Net Dashboard with live data

The mail archive is a copy of all the mail sent to the mail address: log4net-user@logging.apache.org, organized as a forum.

If you would like to participate in the mail list, send a mail to log4net-user-subscribe@logging.apache.org.

More information about the mailing list is available on: http://logging.apache.org/log4net/support.html

 

A complete topic list is available and can be viewed here (warning, it takes some time to load)

 

Copyright 2005-2008 by FaktNet AS Terms Of Use Privacy Statement