Nicko,
A tried the MySQL connector first with this appender:
<appender name="ADONetAppender_MySqlServer"
type="log4net.Appender.ADONetAppender" >
<bufferSize value="1" />
<param name="ConnectionType"
value="MySql.Data.MySqlClient.MySqlConnection, MySql.Data" />
<param name="ConnectionString"
value="database=log4net;server=localhost;user id=user;password=userpass"
/>
<param name="CommandText" value="INSERT INTO log
(Date,Thread,Level,Logger,Message) VALUES (@log_date, @thread,
@log_level, @logger, @message)" />
<param name="Parameter">
<param name="ParameterName" value="@log_date" />
<param name="DbType" value="DateTime" />
<param name="Layout"
type="log4net.Layout.PatternLayout">
<param name="ConversionPattern"
value="%d{yyyy'-'MM'-'dd HH':'mm':'ss'.'fff}" />
</param>
</param>
<param name="Parameter">
<....
Visual.net return this in output windows with log4net debug=true:
For each parameter:
log4net: DOMConfigurator: Setting Property [ParameterName] to String
value [EMAIL PROTECTED]
log4net: DOMConfigurator: Setting Property [DbType] to DbType value
[DateTime]
log4net: DOMConfigurator: Setting Property [ConversionPattern] to String
value [%d{yyyy'-'MM'-'dd HHlog4net: DOMConfigurator: Setting Property
[ConversionPattern] to String value [%d{yyyy'-'MM'-'dd
HH':'mm':'ss'.'fff}]
log4net: DOMConfigurator: Setting Property [Layout] to object
[log4net.Layout.Layout2RawLayoutAdapter]
log4net: DOMConfigurator: Setting Collection Property [AddParameter] to
object [log4net.Appender.ADONetAppenderParameter]
...
(and at the end)
...
log4net: DOMConfigurator: Created Appender [ADONetAppender_MySqlServer]
log4net: DOMConfigurator: Adding appender named
[ADONetAppender_MySqlServer] to logger [root].
log4net: DOMConfigurator: Hierarchy Threshold []
log4net: DOMConfigurator: Created Appender [ADONetAppender_MySqlServer]
log4net: DOMConfigurator: Adding appender named
[ADONetAppender_MySqlServer] to logger [root].
log4net: DOMConfigurator: Hierarchy Threshold []log4net:ERROR
[ADONetAppender] Exception while writing to database
MySql.Data.MySqlClient.MySqlException: Parameter '@log_date' not found
in collection
at MySql.Data.MySqlClient.MySqlParameterCollection.IndexOf(String
parameterName)
at MySql.Data.MySqlClient.MySqlParameterCollection.get_Item(String
name)
at
MySql.Data.MySqlClient.MySqlParameterCollection.System.Data.IDataParamet
erCollection.get_Item(String name)
at log4net.Appender.ADONetAppenderParameter.FormatValue(IDbCommand
command, LoggingEvent loggingEvent)
at log4net.Appender.ADONetAppender.SendBuffer(IDbTransaction dbTran,
LoggingEvent[] events)
at log4net.Appender.ADONetAppender.SendBuffer(LoggingEvent[] events)
In fact, this is an MySql.Data error. After I tried the ByteFX.Data
assambly on a MySql 4.0 Database. And it works very well.
The MySql assambly is well loaded, but it seems that I have forgotten a
parameter for this interface.
Is it possible to have an uncompatibility with the official MySql
connector?
Thanks for your help
David
-----Message d'origine-----
De�: Nicko Cadell [mailto:[EMAIL PROTECTED]
Envoy�: samedi 27 novembre 2004 13:18
��: Log4NET User
Objet�: RE: ASP.NET and log4net
Marc,
How are you configuring log4net? Programmatically? Or using the
DOMConfiguratorAttribute?
Have you tried adding:
<add key="log4net.Internal.Debug" value="true"/>
To your appSettings block in your Web.config, see:
http://logging.apache.org/log4net/release/manual/faq.html#internalDebug
As you are trying to get the debug from a service you will probably need
to use DebugView from http://www.sysinternals.com.
Nicko
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> Sent: 26 November 2004 10:50
> To: [email protected]
> Subject: ASP.NET and log4net
>
>
> Hi there ...
>
> I'm trying to use log4net with one of my asp.net
> applications. I used log4net for some windows apps already
> but I have some problems now ... here my env
>
> .net framework 1.1
> log4net 1.2.0-beta8
>
> I have the following in my web.config:
>
> <?xml version="1.0" encoding="utf-8" ?> <configuration>
>
> <configSections>
> <section name="log4net"
> type="log4net.Config.Log4NetconfigurationSectionHandler,log4ne
> t" /> </configSections>
>
> <!-- This section contains the log4net configuration
> settings -->
> <log4net debug="true">
> <!-- Define some output appenders -->
> <appender name="RollingLogFileAppender"
> type="log4net.Appender.RollingFileAppender">
> <param name="File" value="log\\log.txt" />
> <param name="AppendToFile" value="true" />
> <param name="MaxSizeRollBackups"
> value="10" />
> <param name="MaximumFileSize" value="5MB" />
> <param name="RollingStyle" value="Size" />
> <param name="StaticLogFileName"
> value="true" />
> <layout type="log4net.Layout.PatternLayout">
> <param
> name="ConversionPattern" value="%d [%t] %-5p %c [%x] - %m%n" />
> </layout>
> </appender>
> <!-- Setup the root category, add the
> appenders and set the default level -->
> <root>
> <level value="DEBUG" />
> <appender-ref ref="RollingLogFileAppender" />
> </root>
> </log4net>
>
> this would log into the log directory in my root path of the
> asp.net application .. right? This folder exists and aspnet
> user has full control on it.
>
> In the source of the Default.aspx for example I have:
>
> namespace UniqueIDUserInterface
> {
> ....
> // Create a logger for use in this class
> private static readonly log4net.ILog log =
> log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetC
> urrentMethod().DeclaringType);
>
>
> And in the procedures I use
>
> log.Error("Erorr blablablabla");
>
> this should be correct, yes?
> But it does not log anything
>
> Also I thought that <log4net debug="true"> should enable
> internal debugging ...
> Somehow I think that all my settings in web.config are not
> used .... could that be?
> What can I do to debug this problem?
> Any ideas?
>
>
>
> --
> Freundliche Gr�sse / Kind regards
> Eggenberger Marc
> Technology Manager
>
>
>
> :.________________
> CONFIDENTIALITY : This e-mail and any attachments are
> confidential and may be privileged. If you are not a named
> recipient, please notify the sender immediately and do not
> disclose the contents to another person, use it for any
> purpose or store or copy the information in any medium.
>