RE: Experiencing locks while using AdoNetAppender
Ron and Michael thanks for your suggestions, It is indeed how SQLite works and the locking itself is not the problem. This is expected as multiple processes try to log at once. The ADODBAppender uses a internal buffer to store the logevents. The problem is that with default timeout for the DBCommand of 30 seconds (which is specified in the ADODBAppender) I experience out of memory exceptions as the internal buffers grow too fast while waiting for the timeout. A timeout of say 5s would be better for me. Or better make the timeout configurable through the config file of the ADODBAppender. What would be the best way to make the neccessary changes? Create my own version of the ADODBAppender? Thanks for any reactions, Patrick Van: Ron Grabowski [mailto:rongrabow...@yahoo.com] Verzonden: Wednesday, August 19, 2009 3:36 AM Aan: Log4NET User Onderwerp: Re: Experiencing locks while using AdoNetAppender I think that's how SQLite works. Have you tried writing to a single .db file from multiple threads without using log4net? From: Patrick Kalkman p...@hoogendoorn.nl To: log4net-user@logging.apache.org Sent: Tuesday, August 18, 2009 8:29:17 AM Subject: Experiencing locks while using AdoNetAppender Hi, I am using the AdoNetAppender for logging messages from multiple application. All the applications log into one sqllite database. Sometimes when a lot of information is logged I am experiencing exceptions like: log4net:ERROR [AdoNetAppender] Exception while writing to database System.Data.SQLite.SQLiteException: The database file is locked database is locked at System.Data.SQLite.SQLite3.Reset(SQLiteStatement stmt) at System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt) at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery() at System.Data.SQLite.SQLiteTransaction..ctor(SQLiteConnection connection, Boolean deferredLock) at System.Data.SQLite.SQLiteConnection.BeginTransaction(Boolean deferredLock) at System.Data.SQLite.SQLiteConnection.BeginDbTransaction(IsolationLevel isolationLevel) at System.Data.Common.DbConnection.System.Data.IDbConnection.BeginTransacti on() at log4net.Appender.AdoNetAppender.SendBuffer(LoggingEvent[] events) The default CommandTimeout in the AdoNetAppender on the IDbCommand is 30 seconds, but I would like to influence this timeout in the log4net configuration (file) so that I can influence the timeout on the logging if the database is locked for a longer portion of time. Reducing the timeout may lead to events getting lost, but I prefer that to our application hanging for the full CommandTimeout waiting for the database to become unlocked. Is it possible to configure the timeout using configuration? or would it be better to choose for a solution like deriving from the AdoNetAppender and add the functionality? Thanks in advance for any answers. Patrick **DISCLAIMER** Deze E-mail is uitsluitend bestemd voor de geadresseerde(n). Verstrekking aan en gebruik door anderen is niet toegestaan. De Hoogendoorn Groep sluit iedere aansprakelijkheid uit die voortvloeit uit elektronische verzending. This E-mail is intended exclusively for the addressee(s), and may not be passed on to, or made available for use by any person other than the addressee(s). The Hoogendoorn Group rules out any and every liability resulting from any electronic transmission. *** This message has been scanned by Network Associates' McAfee AntiVirus Technology
Experiencing locks while using AdoNetAppender
Hi, I am using the AdoNetAppender for logging messages from multiple application. All the applications log into one sqllite database. Sometimes when a lot of information is logged I am experiencing exceptions like: log4net:ERROR [AdoNetAppender] Exception while writing to database System.Data.SQLite.SQLiteException: The database file is locked database is locked at System.Data.SQLite.SQLite3.Reset(SQLiteStatement stmt) at System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt) at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery() at System.Data.SQLite.SQLiteTransaction..ctor(SQLiteConnection connection, Boolean deferredLock) at System.Data.SQLite.SQLiteConnection.BeginTransaction(Boolean deferredLock) at System.Data.SQLite.SQLiteConnection.BeginDbTransaction(IsolationLevel isolationLevel) at System.Data.Common.DbConnection.System.Data.IDbConnection.BeginTransacti on() at log4net.Appender.AdoNetAppender.SendBuffer(LoggingEvent[] events) The default CommandTimeout in the AdoNetAppender on the IDbCommand is 30 seconds, but I would like to influence this timeout in the log4net configuration (file) so that I can influence the timeout on the logging if the database is locked for a longer portion of time. Reducing the timeout may lead to events getting lost, but I prefer that to our application hanging for the full CommandTimeout waiting for the database to become unlocked. Is it possible to configure the timeout using configuration? or would it be better to choose for a solution like deriving from the AdoNetAppender and add the functionality? Thanks in advance for any answers. Patrick **DISCLAIMER** Deze E-mail is uitsluitend bestemd voor de geadresseerde(n). Verstrekking aan en gebruik door anderen is niet toegestaan. De Hoogendoorn Groep sluit iedere aansprakelijkheid uit die voortvloeit uit elektronische verzending. This E-mail is intended exclusively for the addressee(s), and may not be passed on to, or made available for use by any person other than the addressee(s). The Hoogendoorn Group rules out any and every liability resulting from any electronic transmission. *** This message has been scanned by Network Associates' McAfee AntiVirus Technology
RE: Experiencing locks while using AdoNetAppender
Hi, I have seen similar behaviour when working with Access. I know this wont help, but I found it to be a limitation of file based databases unfortunately :( Subject: Experiencing locks while using AdoNetAppender Date: Tue, 18 Aug 2009 14:29:17 +0200 From: p...@hoogendoorn.nl To: log4net-user@logging.apache.org Hi, I am using the AdoNetAppender for logging messages from multiple application. All the applications log into one sqllite database. Sometimes when a lot of information is logged I am experiencing exceptions like: log4net:ERROR [AdoNetAppender] Exception while writing to database System.Data.SQLite.SQLiteException: The database file is locked database is locked at System.Data.SQLite.SQLite3.Reset(SQLiteStatement stmt) at System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt) at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery() at System.Data.SQLite.SQLiteTransaction..ctor(SQLiteConnection connection, Boolean deferredLock) at System.Data.SQLite.SQLiteConnection.BeginTransaction(Boolean deferredLock) at System.Data.SQLite.SQLiteConnection.BeginDbTransaction(IsolationLevel isolationLevel) at System.Data.Common.DbConnection.System.Data.IDbConnection.BeginTransaction() at log4net.Appender.AdoNetAppender.SendBuffer(LoggingEvent[] events) The default CommandTimeout in the AdoNetAppender on the IDbCommand is 30 seconds, but I would like to influence this timeout in the log4net configuration (file) so that I can influence the timeout on the logging if the database is locked for a longer portion of time. Reducing the timeout may lead to events getting lost, but I prefer that to our application hanging for the full CommandTimeout waiting for the database to become unlocked. Is it possible to configure the timeout using configuration? or would it be better to choose for a solution like deriving from the AdoNetAppender and add the functionality? Thanks in advance for any answers. Patrick **DISCLAIMER** Deze E-mail is uitsluitend bestemd voor de geadresseerde(n). Verstrekking aan en gebruik door anderen is niet toegestaan. De Hoogendoorn Groep sluit iedere aansprakelijkheid uit die voortvloeit uit elektronische verzending. This E-mail is intended exclusively for the addressee(s), and may not be passed on to, or made available for use by any person other than the addressee(s). The Hoogendoorn Group rules out any and every liability resulting from any electronic transmission. *** This message has been scanned by Network Associates' McAfee AntiVirus Technology _ Windows Live Messenger: Celebrate 10 amazing years with free winks and emoticons. http://clk.atdmt.com/UKM/go/157562755/direct/01/
Re: Experiencing locks while using AdoNetAppender
I think that's how SQLite works. Have you tried writing to a single .db file from multiple threads without using log4net? From: Patrick Kalkman p...@hoogendoorn.nl To: log4net-user@logging.apache.org Sent: Tuesday, August 18, 2009 8:29:17 AM Subject: Experiencing locks while using AdoNetAppender Experiencing locks while using AdoNetAppender Hi, I am using the AdoNetAppender for logging messages from multiple application. All the applications log into one sqllite database. Sometimes when a lot of information is logged I am experiencing exceptions like: log4net:ERROR [AdoNetAppender] Exception while writing to database System.Data.SQLite.SQLiteException: The database file is locked database is locked at System.Data.SQLite.SQLite3.Reset(SQLiteStatement stmt) at System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt) at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery() at System.Data.SQLite.SQLiteTransaction..ctor(SQLiteConnection connection, Boolean deferredLock) at System.Data.SQLite.SQLiteConnection.BeginTransaction(Boolean deferredLock) at System.Data.SQLite.SQLiteConnection.BeginDbTransaction(IsolationLevel isolationLevel) at System.Data.Common.DbConnection.System.Data.IDbConnection.BeginTransaction() at log4net.Appender.AdoNetAppender.SendBuffer(LoggingEvent[] events) The default CommandTimeout in the AdoNetAppender on the IDbCommand is 30 seconds, but I would like to influence this timeout in the log4net configuration (file) so that I can influence the timeout on the logging if the database is locked for a longer portion of time. Reducing the timeout may lead to events getting lost, but I prefer that to our application hanging for the full CommandTimeout waiting for the database to become unlocked. Is it possible to configure the timeout using configuration? or would it be better to choose for a solution like deriving from the AdoNetAppender and add the functionality? Thanks in advance for any answers. Patrick **DISCLAIMER** Deze E-mail is uitsluitend bestemd voor de geadresseerde(n). Verstrekking aan en gebruik door anderen is niet toegestaan. De Hoogendoorn Groep sluit iedere aansprakelijkheid uit die voortvloeit uit elektronische verzending. This E-mail is intended exclusively for the addressee(s), and may not be passed on to, or made available for use by any person other than the addressee(s). The Hoogendoorn Group rules out any and every liability resulting from any electronic transmission. *** This message has been scanned by Network Associates' McAfee AntiVirus Technology
Re: Experiencing locks while using AdoNetAppender
Not sure if this has changed, but I'm pretty sure there is a database lock on inserts/updates. So only one insert at a time. You might try the BufferedForwardingAppender. It might serialize the inserts for you. On Aug 18, 2009, at 8:36 PM, Ron Grabowski rongrabow...@yahoo.com wrote: I think that's how SQLite works. Have you tried writing to a single .db file from multiple threads without using log4net? From: Patrick Kalkman p...@hoogendoorn.nl To: log4net-user@logging.apache.org Sent: Tuesday, August 18, 2009 8:29:17 AM Subject: Experiencing locks while using AdoNetAppender Hi, I am using the AdoNetAppender for logging messages from multiple application. All the applications log into one sqllite database. Sometimes when a lot of information is logged I am experiencing exceptions like: log4net:ERROR [AdoNetAppender] Exception while writing to database System.Data.SQLite.SQLiteException: The database file is locked database is locked at System.Data.SQLite.SQLite3.Reset(SQLiteStatement stmt) at System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt) at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery() at System.Data.SQLite.SQLiteTransaction..ctor(SQLiteConnection connection, Boolean deferredLock) at System.Data.SQLite.SQLiteConnection.BeginTransaction(Boolean deferredLock) at System.Data.SQLite.SQLiteConnection.BeginDbTransaction (IsolationLevel isolationLevel) at System.Data.Common.DbConnection.System.Data.IDbConnection.BeginTransaction( ) at log4net.Appender.AdoNetAppender.SendBuffer(LoggingEvent[] events) The default CommandTimeout in the AdoNetAppender on the IDbCommand is 30 seconds, but I would like to influence this timeout in the log4net configuration (file) so that I can influence the timeout on the logging if the database is locked for a longer portion of time. Reducing the timeout may lead to events getting lost, but I prefer that to our application hanging for the full CommandTimeout waiting for the database to become unlocked. Is it possible to configure the timeout using configuration? or would it be better to choose for a solution like deriving from the AdoNetAppender and add the functionality? Thanks in advance for any answers. Patrick **DISCLAIMER** Deze E-mail is uitsluitend bestemd voor de geadresseerde(n). Verstrekking aan en gebruik door anderen is niet toegestaan. De Hoogendoorn Groep sluit iedere aansprakelijkheid uit die voortvloeit uit elektronische verzending. This E-mail is intended exclusively for the addressee(s), and may not be passed on to, or made available for use by any person other than the addressee(s). The Hoogendoorn Group rules out any and every liability resulting from any electronic transmission. *** This message has been scanned by Network Associates' McAfee AntiVirus Technology
RE: Using AdoNetAppender
Hi Ron, For sure, I totally understand that! I think it would be good to include some C# config examples. I just have to finish off my wrapper and then I'll get my C# code over to you for comment / inclusion in the docs. Thanks! James. _ From: Ron Grabowski [mailto:rongrabow...@yahoo.com] Sent: 16 June 2009 23:00 To: Log4NET User Subject: Re: Using AdoNetAppender Its quite difficult to document every possible usage of a library. In addition to these documents: http://logging.apache.org/log4net/release/config-examples.html http://logging.apache.org/log4net/release/sdk/log4net.Appender.AdoNetApp ender.html http://logging.apache.org/log4net/release/sdk/log4net.Appender.AdoNetApp enderParameter.Layout.html There's about 8,000 search results on Google for AdoNetAppender. A lot of the documentation is focused on XML examples because that's how the majority of the users configure log4net. I'll glady add your code configuration examples to AdoNetAppenderTest.cs if attach them to a JIRA ticket! _ From: James Green james.gr...@occam-dm.com To: Log4NET User log4net-user@logging.apache.org Sent: Tuesday, June 16, 2009 4:48:27 AM Subject: RE: Using AdoNetAppender Hi Again, Surely, this is all pointing to a far bigger problem. That is an horrific piece of code!! Surely this is doable in pure C#? I'm amazed that this AdoNetAppender is so poorly documented and has so few examples. It's starting to put me off log4net! James. _ From: Ron Grabowski [mailto:rongrabow...@yahoo.com] Sent: 15 June 2009 22:32 To: Log4NET User Subject: Re: Using AdoNetAppender This page shows an example of loading an xml string into an XmlDocument then configure log4net from the XmlDocument: http://svn.apache.org/viewvc/logging/log4net/trunk/tests/src/Appender/Ad oNetAppenderTest.cs?view=co _ From: James Green james.gr...@occam-dm.com To: Log4NET User log4net-user@logging.apache.org Sent: Monday, June 15, 2009 12:04:16 PM Subject: RE: Using AdoNetAppender I think I'm going to have to try the config file method first. I'm wrapping log4net and I don't want to cause every consuming component to require loads of config information in it just for logging purposes. Everything else is a sinch to configure in code, save for this appender ... *sigh* ... Cheers, James. scanned by MessageLabs [www.messagelabs.com] scanned by MessageLabs [www.messagelabs.com]
RE: Using AdoNetAppender
Hi Ron, I did actually spot this just after posting the code and it did remove the connection error I was seeing. However, we have got it logging the date values now, however the other fields are @log_level etc ... are still null. Any ideas? Cheers, James. _ From: Ron Grabowski [mailto:rongrabow...@yahoo.com] Sent: 15 June 2009 22:01 To: Log4NET User Subject: Re: Using AdoNetAppender If you don't specify a ConnectionType AdoNetAppender defaults to using OleDbConnection which has a different connection string format than the more common SqlConnection. Are you sure you want to use OleDbConnection? Why not write a simple ConsoleApplication to test your code and look at the configuration output log4net writes to Console.Out? class Program { private static AdoNetAppender _sqlDatabaseAppender = new AdoNetAppender(); static void Main(string[] args) { LogLog.InternalDebugging = true; LogLog.EmitInternalMessages = true; ConfigureDatabaseAppender(...); ILog log = LogManager.GetLogger(typeof(Program)); log.Debug(Hello World); Console.ReadLine(); } public static void ConfigureDatabaseAppender(string connString) { // snip _ From: James Green james.gr...@occam-dm.com To: Log4NET User log4net-user@logging.apache.org Sent: Monday, June 15, 2009 12:04:16 PM Subject: RE: Using AdoNetAppender I think I'm going to have to try the config file method first. I'm wrapping log4net and I don't want to cause every consuming component to require loads of config information in it just for logging purposes. Everything else is a sinch to configure in code, save for this appender ... *sigh* ... Cheers, James. scanned by MessageLabs [www.messagelabs.com]
RE: Using AdoNetAppender
Hi Again, Surely, this is all pointing to a far bigger problem. That is an horrific piece of code!! Surely this is doable in pure C#? I'm amazed that this AdoNetAppender is so poorly documented and has so few examples. It's starting to put me off log4net! James. _ From: Ron Grabowski [mailto:rongrabow...@yahoo.com] Sent: 15 June 2009 22:32 To: Log4NET User Subject: Re: Using AdoNetAppender This page shows an example of loading an xml string into an XmlDocument then configure log4net from the XmlDocument: http://svn.apache.org/viewvc/logging/log4net/trunk/tests/src/Appender/Ad oNetAppenderTest.cs?view=co _ From: James Green james.gr...@occam-dm.com To: Log4NET User log4net-user@logging.apache.org Sent: Monday, June 15, 2009 12:04:16 PM Subject: RE: Using AdoNetAppender I think I'm going to have to try the config file method first. I'm wrapping log4net and I don't want to cause every consuming component to require loads of config information in it just for logging purposes. Everything else is a sinch to configure in code, save for this appender ... *sigh* ... Cheers, James. scanned by MessageLabs [www.messagelabs.com]
Re: Using AdoNetAppender
why don't you write a fluent interface for it!?!? I think that for FREE software provided with SOURCE - it's a pretty darn good tool at a pretty darn good price - and so does the rest of the _whole_ industry - it being an _industry_ _standard_! There are plenty of other loggers out there too - for free - open source - some good some not so good - all off the backs of some very hard work by some very tallented and commited people. w:// On Tue, Jun 16, 2009 at 9:48 AM, James Green james.gr...@occam-dm.comwrote: Hi Again, Surely, this is all pointing to a far bigger problem. That is an horrific piece of code!! Surely this is doable in pure C#? I'm amazed that this AdoNetAppender is so poorly documented and has so few examples. It's starting to put me off log4net! James. -- *From:* Ron Grabowski [mailto:rongrabow...@yahoo.com] *Sent:* 15 June 2009 22:32 *To:* Log4NET User *Subject:* Re: Using AdoNetAppender This page shows an example of loading an xml string into an XmlDocument then configure log4net from the XmlDocument: http://svn.apache.org/viewvc/logging/log4net/trunk/tests/src/Appender/AdoNetAppenderTest.cs?view=co -- *From:* James Green james.gr...@occam-dm.com *To:* Log4NET User log4net-user@logging.apache.org *Sent:* Monday, June 15, 2009 12:04:16 PM *Subject:* RE: Using AdoNetAppender I think I'm going to have to try the config file method first. I'm wrapping log4net and I don't want to cause every consuming component to require loads of config information in it just for logging purposes. Everything else is a sinch to configure in code, save for this appender ... *sigh* ... Cheers, James. scanned by MessageLabs [www.messagelabs.com] -- Cheers, w://
Re: Using AdoNetAppender
No I haven't - and to be fair, I did try doing this a while ago: code file='global.asax' method='Application_Start' log4net.Config.XmlConfigurator.Configure(); //reset the logger to use the default con string - so we only need to change it on one place var hier = log4net.LogManager.GetRepository() as log4net.Repository.Hierarchy.Hierarchy; if (hier != null) { //get ADONetAppender var adoAppender = (log4net.Appender.AdoNetAppender)hier.GetLogger(root,hier.LoggerFactory).GetAppender(AdoNetAppender); var adoAppender = (log4net.Appender.AdoNetAppender)hier.Root.Appenders[0]; if (adoAppender != null) { adoAppender.ConnectionString = AppSettings.GetConfigurationString(MainConnection); adoAppender.ActivateOptions(); //refresh settings of appender } } /code and failed - but this is possibly because of a few things outside the responsibility of the log4net codebase. There's nothing wrong working through a poroblem - to help improve the situ - but just rubbishing it won't help anyone. w:// On Tue, Jun 16, 2009 at 10:08 AM, James Green james.gr...@occam-dm.com wrote: Hi Wayne, I didn't wish to start a flame war. This is not the first time I've had trouble finding decent log4net docs when configuring without AppConfig, in fact Google hardly returns a thing on this topic. Surely database logging is one of the most popular features and I'm highlighting what I think to be a massive gap in its documentation. I love log4net, it was a no brainer for me to pick but don't think getting this library configured using pure C# is easy. Have you completed this task without using Xml config? Xml config is not always possible nor desirable. James. From: codingvi...@googlemail.com [mailto:codingvi...@googlemail.com] On Behalf Of Wayne Douglas Sent: 16 June 2009 09:58 To: Log4NET User Subject: Re: Using AdoNetAppender why don't you write a fluent interface for it!?!? I think that for FREE software provided with SOURCE - it's a pretty darn good tool at a pretty darn good price - and so does the rest of the _whole_ industry - it being an _industry_ _standard_! There are plenty of other loggers out there too - for free - open source - some good some not so good - all off the backs of some very hard work by some very tallented and commited people. w:// On Tue, Jun 16, 2009 at 9:48 AM, James Green james.gr...@occam-dm.com wrote: Hi Again, Surely, this is all pointing to a far bigger problem. That is an horrific piece of code!! Surely this is doable in pure C#? I'm amazed that this AdoNetAppender is so poorly documented and has so few examples. It's starting to put me off log4net! James. From: Ron Grabowski [mailto:rongrabow...@yahoo.com] Sent: 15 June 2009 22:32 To: Log4NET User Subject: Re: Using AdoNetAppender This page shows an example of loading an xml string into an XmlDocument then configure log4net from the XmlDocument: http://svn.apache.org/viewvc/logging/log4net/trunk/tests/src/Appender/AdoNetAppenderTest.cs?view=co From: James Green james.gr...@occam-dm.com To: Log4NET User log4net-user@logging.apache.org Sent: Monday, June 15, 2009 12:04:16 PM Subject: RE: Using AdoNetAppender I think I'm going to have to try the config file method first. I'm wrapping log4net and I don't want to cause every consuming component to require loads of config information in it just for logging purposes. Everything else is a sinch to configure in code, save for this appender ... *sigh* ... Cheers, James. scanned by MessageLabs [www.messagelabs.com] -- Cheers, w:// scanned by MessageLabs [www.messagelabs.com] -- Cheers, w://
RE: Using AdoNetAppender
Cracked it ... AdoNetAppenderParameter logLevel = new AdoNetAppenderParameter(); logLevel.ParameterName = @log_level; logLevel.Layout = new Layout2RawLayoutAdapter(new PatternLayout(%level)); logLevel.Size = 50; logLevel.DbType = System.Data.DbType.String; _sqlDatabaseAppender.AddParameter(logLevel); Regards, James.
Re: Using AdoNetAppender
bet that was a 'punching hands in the air' geek moment from hell On Tue, Jun 16, 2009 at 10:58 AM, James Greenjames.gr...@occam-dm.com wrote: Cracked it ... AdoNetAppenderParameter logLevel = new AdoNetAppenderParameter(); logLevel.ParameterName = @log_level; logLevel.Layout = new Layout2RawLayoutAdapter(new PatternLayout(%level)); logLevel.Size = 50; logLevel.DbType = System.Data.DbType.String; _sqlDatabaseAppender.AddParameter(logLevel); Regards, James. -- Cheers, w://
RE: Using AdoNetAppender
bet that was a 'punching hands in the air' geek moment from hell Indeed ... I may even make a cup of tea to celebrate! :) Cheers, James.
Re: Using AdoNetAppender
Its quite difficult to document every possible usage of a library. In addition to these documents: http://logging.apache.org/log4net/release/config-examples.html http://logging.apache.org/log4net/release/sdk/log4net.Appender.AdoNetAppender.html http://logging.apache.org/log4net/release/sdk/log4net.Appender.AdoNetAppenderParameter.Layout.html There's about 8,000 search results on Google for AdoNetAppender. A lot of the documentation is focused on XML examples because that's how the majority of the users configure log4net. I'll glady add your code configuration examples to AdoNetAppenderTest.cs if attach them to a JIRA ticket! From: James Green james.gr...@occam-dm.com To: Log4NET User log4net-user@logging.apache.org Sent: Tuesday, June 16, 2009 4:48:27 AM Subject: RE: Using AdoNetAppender Hi Again, Surely, this is all pointing to a far bigger problem. That is an horrific piece of code!! Surely this is doable in pure C#? I'm amazed that this AdoNetAppender is so poorly documented and has so few examples. It's starting to put me off log4net! James. From: Ron Grabowski [mailto:rongrabow...@yahoo.com] Sent: 15 June 2009 22:32 To: Log4NET User Subject: Re: Using AdoNetAppender This page shows an example of loading an xml string into an XmlDocument then configure log4net from the XmlDocument: http://svn.apache.org/viewvc/logging/log4net/trunk/tests/src/Appender/AdoNetAppenderTest.cs?view=co From: James Green james.gr...@occam-dm.com To: Log4NET User log4net-user@logging.apache.org Sent: Monday, June 15, 2009 12:04:16 PM Subject: RE: Using AdoNetAppender I think I'm going to have to try the config file method first. I'm wrapping log4net and I don't want to cause every consuming component to require loads of config information in it just for logging purposes. Everything else is a sinch to configure in code, save for this appender ... *sigh* ... Cheers, James. scanned by MessageLabs [www.messagelabs.com]
Re: Using AdoNetAppender
You could have also copied the built-in TimeStamp layout // log4net.Layout public class RawTimeStampLayout : IRawLayout { public object Format(LoggingEvent loggingEvent) { return loggingEvent.TimeStamp; } } and made your own Level layout: public class RawLevelLayout : IRawLayout { public object Format(LoggingEvent loggingEvent) { return loggingEvent.Level; } } - Original Message From: James Green james.gr...@occam-dm.com To: Log4NET User log4net-user@logging.apache.org Sent: Tuesday, June 16, 2009 5:58:12 AM Subject: RE: Using AdoNetAppender Cracked it ... AdoNetAppenderParameter logLevel = new AdoNetAppenderParameter(); logLevel.ParameterName = @log_level; logLevel.Layout = new Layout2RawLayoutAdapter(new PatternLayout(%level)); logLevel.Size = 50; logLevel.DbType = System.Data.DbType.String; _sqlDatabaseAppender.AddParameter(logLevel); Regards, James.
Using AdoNetAppender
Hi All, I've spent about 4 hours today trying to get this working and have totally failed so far. I can't even really find much info on how to configure this purely in Code. In fact there is precious little I can find on the net in fact. Here is the code I'm using the set up the AdoNetAppender in my app: public static void ConfigureDatabaseAppender(string connString) { PatternLayout layout = GetDefaultLayout(); _sqlDatabaseAppender = new AdoNetAppender(); _sqlDatabaseAppender.Layout = layout; _sqlDatabaseAppender.UseTransactions = false; _sqlDatabaseAppender.BufferSize = 1; _sqlDatabaseAppender.CommandType = System.Data.CommandType.Text; _sqlDatabaseAppender.ConnectionString = connString; _sqlDatabaseAppender.CommandText = INSERT INTO Log ([Date],[Level],[Thread],[Logger],[Message],[Exception]) VALUES (@log_date, @log_level, @thread, @logger, @message, @exception); AdoNetAppenderParameter logDate = new AdoNetAppenderParameter(); RawTimeStampLayout dateLayout = new RawTimeStampLayout(); logDate.ParameterName = @log_date; logDate.Layout = dateLayout; logDate.DbType = System.Data.DbType.DateTime; _sqlDatabaseAppender.AddParameter(logDate); AdoNetAppenderParameter logThread = new AdoNetAppenderParameter(); logThread.ParameterName = @thread; logThread.Size = 255; logThread.DbType = System.Data.DbType.String; _sqlDatabaseAppender.AddParameter(logThread); AdoNetAppenderParameter logLevel = new AdoNetAppenderParameter(); logLevel.ParameterName = @log_level; logLevel.Size = 50; logLevel.DbType = System.Data.DbType.String; _sqlDatabaseAppender.AddParameter(logLevel); AdoNetAppenderParameter logLogger = new AdoNetAppenderParameter(); logLogger.ParameterName = @logger; logLogger.Size = 255; logLogger.DbType = System.Data.DbType.String; _sqlDatabaseAppender.AddParameter(logLogger); AdoNetAppenderParameter logMessage = new AdoNetAppenderParameter(); logMessage.ParameterName = @message; logMessage.Size = 4000; logMessage.DbType = System.Data.DbType.String; _sqlDatabaseAppender.AddParameter(logMessage); AdoNetAppenderParameter logException = new AdoNetAppenderParameter(); logException.ParameterName = @exception; logException.Size = 2000; logException.DbType = System.Data.DbType.String; _sqlDatabaseAppender.AddParameter(logException); _sqlDatabaseAppender.ActivateOptions(); BasicConfigurator.Configure(_sqlDatabaseAppender); } Any help would be great. James.
RE: Using AdoNetAppender
Have you already gotten AdoNetAppender to work from a app.config / web.config first? If not, I'd suggest getting that to work first. You may learn something in that process and it'll spark a realization of what you're missing in the from-code approach? -Original Message- From: James Green [mailto:james.gr...@occam-dm.com] Sent: Monday, June 15, 2009 9:26 AM To: Log4NET User Subject: Using AdoNetAppender Hi All, I've spent about 4 hours today trying to get this working and have totally failed so far. I can't even really find much info on how to configure this purely in Code. In fact there is precious little I can find on the net in fact. Here is the code I'm using the set up the AdoNetAppender in my app: public static void ConfigureDatabaseAppender(string connString) { PatternLayout layout = GetDefaultLayout(); _sqlDatabaseAppender = new AdoNetAppender(); _sqlDatabaseAppender.Layout = layout; _sqlDatabaseAppender.UseTransactions = false; _sqlDatabaseAppender.BufferSize = 1; _sqlDatabaseAppender.CommandType = System.Data.CommandType.Text; _sqlDatabaseAppender.ConnectionString = connString; _sqlDatabaseAppender.CommandText = INSERT INTO Log ([Date],[Level],[Thread],[Logger],[Message],[Exception]) VALUES (@log_date, @log_level, @thread, @logger, @message, @exception); AdoNetAppenderParameter logDate = new AdoNetAppenderParameter(); RawTimeStampLayout dateLayout = new RawTimeStampLayout(); logDate.ParameterName = @log_date; logDate.Layout = dateLayout; logDate.DbType = System.Data.DbType.DateTime; _sqlDatabaseAppender.AddParameter(logDate); AdoNetAppenderParameter logThread = new AdoNetAppenderParameter(); logThread.ParameterName = @thread; logThread.Size = 255; logThread.DbType = System.Data.DbType.String; _sqlDatabaseAppender.AddParameter(logThread); AdoNetAppenderParameter logLevel = new AdoNetAppenderParameter(); logLevel.ParameterName = @log_level; logLevel.Size = 50; logLevel.DbType = System.Data.DbType.String; _sqlDatabaseAppender.AddParameter(logLevel); AdoNetAppenderParameter logLogger = new AdoNetAppenderParameter(); logLogger.ParameterName = @logger; logLogger.Size = 255; logLogger.DbType = System.Data.DbType.String; _sqlDatabaseAppender.AddParameter(logLogger); AdoNetAppenderParameter logMessage = new AdoNetAppenderParameter(); logMessage.ParameterName = @message; logMessage.Size = 4000; logMessage.DbType = System.Data.DbType.String; _sqlDatabaseAppender.AddParameter(logMessage); AdoNetAppenderParameter logException = new AdoNetAppenderParameter(); logException.ParameterName = @exception; logException.Size = 2000; logException.DbType = System.Data.DbType.String; _sqlDatabaseAppender.AddParameter(logException); _sqlDatabaseAppender.ActivateOptions(); BasicConfigurator.Configure(_sqlDatabaseAppender); } Any help would be great. James.
RE: Using AdoNetAppender
I may have to try that. Currently it just fails with an Oject reference not set to an instance of an object. Thanks, James. -Original Message- From: Matt Lund [mailto:ml...@control4.com] Sent: 15 June 2009 16:28 To: Log4NET User Subject: RE: Using AdoNetAppender Have you already gotten AdoNetAppender to work from a app.config / web.config first? If not, I'd suggest getting that to work first. You may learn something in that process and it'll spark a realization of what you're missing in the from-code approach? -Original Message- From: James Green [mailto:james.gr...@occam-dm.com] Sent: Monday, June 15, 2009 9:26 AM To: Log4NET User Subject: Using AdoNetAppender Hi All, I've spent about 4 hours today trying to get this working and have totally failed so far. I can't even really find much info on how to configure this purely in Code. In fact there is precious little I can find on the net in fact. Here is the code I'm using the set up the AdoNetAppender in my app: public static void ConfigureDatabaseAppender(string connString) { PatternLayout layout = GetDefaultLayout(); _sqlDatabaseAppender = new AdoNetAppender(); _sqlDatabaseAppender.Layout = layout; _sqlDatabaseAppender.UseTransactions = false; _sqlDatabaseAppender.BufferSize = 1; _sqlDatabaseAppender.CommandType = System.Data.CommandType.Text; _sqlDatabaseAppender.ConnectionString = connString; _sqlDatabaseAppender.CommandText = INSERT INTO Log ([Date],[Level],[Thread],[Logger],[Message],[Exception]) VALUES (@log_date, @log_level, @thread, @logger, @message, @exception); AdoNetAppenderParameter logDate = new AdoNetAppenderParameter(); RawTimeStampLayout dateLayout = new RawTimeStampLayout(); logDate.ParameterName = @log_date; logDate.Layout = dateLayout; logDate.DbType = System.Data.DbType.DateTime; _sqlDatabaseAppender.AddParameter(logDate); AdoNetAppenderParameter logThread = new AdoNetAppenderParameter(); logThread.ParameterName = @thread; logThread.Size = 255; logThread.DbType = System.Data.DbType.String; _sqlDatabaseAppender.AddParameter(logThread); AdoNetAppenderParameter logLevel = new AdoNetAppenderParameter(); logLevel.ParameterName = @log_level; logLevel.Size = 50; logLevel.DbType = System.Data.DbType.String; _sqlDatabaseAppender.AddParameter(logLevel); AdoNetAppenderParameter logLogger = new AdoNetAppenderParameter(); logLogger.ParameterName = @logger; logLogger.Size = 255; logLogger.DbType = System.Data.DbType.String; _sqlDatabaseAppender.AddParameter(logLogger); AdoNetAppenderParameter logMessage = new AdoNetAppenderParameter(); logMessage.ParameterName = @message; logMessage.Size = 4000; logMessage.DbType = System.Data.DbType.String; _sqlDatabaseAppender.AddParameter(logMessage); AdoNetAppenderParameter logException = new AdoNetAppenderParameter(); logException.ParameterName = @exception; logException.Size = 2000; logException.DbType = System.Data.DbType.String; _sqlDatabaseAppender.AddParameter(logException); _sqlDatabaseAppender.ActivateOptions(); BasicConfigurator.Configure(_sqlDatabaseAppender); } Any help would be great. James. scanned by MessageLabs [www.messagelabs.com]
RE: Using AdoNetAppender
I think I'm going to have to try the config file method first. I'm wrapping log4net and I don't want to cause every consuming component to require loads of config information in it just for logging purposes. Everything else is a sinch to configure in code, save for this appender ... *sigh* ... Cheers, James. _ From: codingvi...@googlemail.com [mailto:codingvi...@googlemail.com] On Behalf Of Wayne Douglas Sent: 15 June 2009 16:57 To: Log4NET User Subject: Re: Using AdoNetAppender AppConfig is much simpler - you should start with that then convert to this if you need to - not sure why you'd need to tho? On Mon, Jun 15, 2009 at 4:31 PM, James Green james.gr...@occam-dm.com wrote: I may have to try that. Currently it just fails with an Oject reference not set to an instance of an object. Thanks, James. -Original Message- From: Matt Lund [mailto:ml...@control4.com] Sent: 15 June 2009 16:28 To: Log4NET User Subject: RE: Using AdoNetAppender Have you already gotten AdoNetAppender to work from a app.config / web.config first? If not, I'd suggest getting that to work first. You may learn something in that process and it'll spark a realization of what you're missing in the from-code approach? -Original Message- From: James Green [mailto:james.gr...@occam-dm.com] Sent: Monday, June 15, 2009 9:26 AM To: Log4NET User Subject: Using AdoNetAppender Hi All, I've spent about 4 hours today trying to get this working and have totally failed so far. I can't even really find much info on how to configure this purely in Code. In fact there is precious little I can find on the net in fact. Here is the code I'm using the set up the AdoNetAppender in my app: public static void ConfigureDatabaseAppender(string connString) { PatternLayout layout = GetDefaultLayout(); _sqlDatabaseAppender = new AdoNetAppender(); _sqlDatabaseAppender.Layout = layout; _sqlDatabaseAppender.UseTransactions = false; _sqlDatabaseAppender.BufferSize = 1; _sqlDatabaseAppender.CommandType = System.Data.CommandType.Text; _sqlDatabaseAppender.ConnectionString = connString; _sqlDatabaseAppender.CommandText = INSERT INTO Log ([Date],[Level],[Thread],[Logger],[Message],[Exception]) VALUES (@log_date, @log_level, @thread, @logger, @message, @exception); AdoNetAppenderParameter logDate = new AdoNetAppenderParameter(); RawTimeStampLayout dateLayout = new RawTimeStampLayout(); logDate.ParameterName = @log_date; logDate.Layout = dateLayout; logDate.DbType = System.Data.DbType.DateTime; _sqlDatabaseAppender.AddParameter(logDate); AdoNetAppenderParameter logThread = new AdoNetAppenderParameter(); logThread.ParameterName = @thread; logThread.Size = 255; logThread.DbType = System.Data.DbType.String; _sqlDatabaseAppender.AddParameter(logThread); AdoNetAppenderParameter logLevel = new AdoNetAppenderParameter(); logLevel.ParameterName = @log_level; logLevel.Size = 50; logLevel.DbType = System.Data.DbType.String; _sqlDatabaseAppender.AddParameter(logLevel); AdoNetAppenderParameter logLogger = new AdoNetAppenderParameter(); logLogger.ParameterName = @logger; logLogger.Size = 255; logLogger.DbType = System.Data.DbType.String; _sqlDatabaseAppender.AddParameter(logLogger); AdoNetAppenderParameter logMessage = new AdoNetAppenderParameter(); logMessage.ParameterName = @message; logMessage.Size = 4000; logMessage.DbType = System.Data.DbType.String; _sqlDatabaseAppender.AddParameter(logMessage); AdoNetAppenderParameter logException = new AdoNetAppenderParameter(); logException.ParameterName = @exception; logException.Size = 2000; logException.DbType = System.Data.DbType.String; _sqlDatabaseAppender.AddParameter(logException); _sqlDatabaseAppender.ActivateOptions(); BasicConfigurator.Configure(_sqlDatabaseAppender); } Any help would be great. James. scanned by MessageLabs [www.messagelabs.com] -- Cheers, w:// scanned by MessageLabs [www.messagelabs.com]
Re: Using AdoNetAppender
If you don't specify a ConnectionType AdoNetAppender defaults to using OleDbConnection which has a different connection string format than the more common SqlConnection. Are you sure you want to use OleDbConnection? Why not write a simple ConsoleApplication to test your code and look at the configuration output log4net writes to Console.Out? class Program { private static AdoNetAppender _sqlDatabaseAppender = new AdoNetAppender(); static void Main(string[] args) { LogLog.InternalDebugging = true; LogLog.EmitInternalMessages = true; ConfigureDatabaseAppender(...); ILog log = LogManager.GetLogger(typeof(Program)); log.Debug(Hello World); Console.ReadLine(); } public static void ConfigureDatabaseAppender(string connString) { // snip From: James Green james.gr...@occam-dm.com To: Log4NET User log4net-user@logging.apache.org Sent: Monday, June 15, 2009 12:04:16 PM Subject: RE: Using AdoNetAppender I think I'm going to have to try the config file method first. I'm wrapping log4net and I don't want to cause every consuming component to require loads of config information in it just for logging purposes. Everything else is a sinch to configure in code, save for this appender ... *sigh* ... Cheers, James.
DbType for CLOB column using AdoNetAppender
Hi,I have sent the followingemail but used a wrong subject(by replying). I'm resending it.Thanks.Hi, I'm using AdoNetAppender to log to an Oracle 10g database. There is a CLOB column used to store diagnosis message with stack trace if there is any. The following config is used for this column. param name="Parameter" param name="ParameterName" value=":message" / param name="DbType" value="String" / param name="Layout" type="log4net.Layout.PatternLayout" param name="ConversionPattern" value="%m" / /param /param When the size of message is greater than 2000 characters, the following exception is thrown (It works fine if the size is less than or equel to 2000). log4net:ERROR [AdoNetAppender] Exception while writing to database System.Data.OracleClient.OracleException: ORA-01461: can bind a LONG value only for insert into a LONG column at System.Data.OracleClient.OracleConnection.CheckError(OciErrorHandle errorHandle, Int32 rc) at System.Data.OracleClient.OracleCommand.Execute(OciHandle statementHandle, CommandBehavior behavior, Boolean isReader, Boolean needRowid, OciHandle rowidDescriptor, ArrayList refCursorParameterOrdinals) at System.Data.OracleClient.OracleCommand.Execute(OciHandle statementHandle, CommandBehavior behavior, Boolean needRowid, OciHandle rowidDescriptor) at System.Data.OracleClient.OracleCommand.ExecuteNonQueryInternal(Boolean needRowid, OciHandle rowidDescriptor) at System.Data.OracleClient.OracleCommand.ExecuteNonQuery() at log4net.Appender.AdoNetAppender.SendBuffer(IDbTransaction dbTran, LoggingEvent[] events) in c:\Work\cvs_root\apache\r1.2.9\logging-log4net\build\package\log4net-1.2.9-beta\src\Appender\AdoNetAppender.cs:line 550 at log4net.Appender.AdoNetAppender.SendBuffer(LoggingEvent[] events) in c:\Work\cvs_root\apache\r1.2.9\logging-log4net\build\package\log4net-1.2.9-beta\src\Appender\AdoNetAppender.cs:line 460 I wonder if DbType "String" is correct for CLOB column. What should be used if it is not? Thanks you in advance for your help. Ping Xie CACI 4831 Walden Lane Lanham, MD 20706 [EMAIL PROTECTED] (301) 306-8200 - Main (301) 306-2829 - Direct Ping XieCACI4831 Walden LaneLanham, MD 20706[EMAIL PROTECTED](301) 306-8200 - Main(301) 306-2829 - DirectThis electronic message contains information from CACI International Inc or subsidiary companies which may be company sensitive proprietary privileged or otherwise protected from disclosure. The information is intended to be used solely by the recipient(s) named above. If you are not an intended recipient be aware that any review disclosure copying distribution or use of this transmission or its contents is prohibited. If you have received this transmission in error please notify us immediately at [EMAIL PROTECTED] With the exception of messages sent by authorized CACI contracts or purchasing personnel nothing in this message may be interpreted as a digital or electronic signature that can be used to: (a) authenticate either the submission or the acceptance of a proposal or offer to contract or (b) modify an existing contract.
RE: Help inserting GUID using AdoNetAppender
Have a look at the log4net.Layout.RawPropertyLayout class. I use that for my layout type, and still set the DbType to Guid. I believe the log4net.Layout.RawPropertyLayout class was introduced in beta9, but you should be able to get it locally and incorporate it into your own build. At least that's what worked for me. ;) -Original Message- From: David Elliott [mailto:[EMAIL PROTECTED] Sent: Monday, April 11, 2005 1:43 PM To: log4net-user@logging.apache.org Subject: Help inserting GUID using AdoNetAppender I am trying to insert a uniqueidentifier (Guid) into a Sql Server table and am having problems. I'm using log4net-1.2.0-beta8. CREATE TABLE [dbo].[Log_Test1] ( [ID] [int] IDENTITY (1, 1) NOT NULL , [DateTime] [datetime] NOT NULL , [RequestID] [uniqueidentifier] NOT NULL , [TaskID] [tinyint] NOT NULL , [State] [tinyint] NOT NULL ) ON [PRIMARY] parameter parameterName value=@reqid / dbType value=uniqueidentifier / layout type=log4net.Layout.PatternLayout conversionPattern value=%X{reqid} / /layout /parameter On startup of the application, I get the following error. log4net: DOMConfigurator: Setting Collection Property [AddParameter] to object [log4net.Appender.ADONetAppenderParameter] log4net: DOMConfigurator: Setting Property [ParameterName] to String value [EMAIL PROTECTED] log4net:ERROR DOMConfigurator: Could not create Appender [MyDBAppender] of type[log4net.Appender.AdoNetAppender]. Reported error follows. System.ArgumentException: Requested value uniqueidentifier was not found. at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase) at log4net.helpers.OptionConverter.ParseEnum(Type enumType, String value, Boolean ignoreCase) at log4net.helpers.OptionConverter.ConvertStringTo(Type target, String txt) at log4net.Repository.Hierarchy.DOMHierarchyConfigurator.ConvertStringTo(Ty pe type, String value) at log4net.Repository.Hierarchy.DOMHierarchyConfigurator.SetParameter(XmlEl ement element, Object target) at log4net.Repository.Hierarchy.DOMHierarchyConfigurator.CreateObjectFromXm l(XmlElement element, Type defaultTargetType, Type typeConstraint) at log4net.Repository.Hierarchy.DOMHierarchyConfigurator.SetParameter(XmlEl ement element, Object target) at log4net.Repository.Hierarchy.DOMHierarchyConfigurator.ParseAppender(XmlE lement appenderElement) log4net:ERROR DOMConfigurator: Appender named [MyDBAppender] not found. If I change to Using Guid parameter parameterName value=@reqid / dbType value=Guid / layout type=log4net.Layout.PatternLayout conversionPattern value=%X{reqid} / /layout /parameter then it will load but then thrown an exception on insertion. log4net:ERROR [ADONetAppender] Exception while writing to database System.InvalidCastException: Invalid cast from System.String to System.Guid. at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at log4net.Appender.ADONetAppender.SendBuffer(IDbTransaction dbTran, LoggingEvent[] events) at log4net.Appender.ADONetAppender.SendBuffer(LoggingEvent[] events) Any thoughts would be appreciated. Dave _ Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
RE: Error using ADONetAppender
I'm try to log messages to Oracle database. I got the following debug errors when run my application. -- - log4net:ERROR [ADONetAppender] Failed to load connection type [System.Data.Oracl eClient.OracleConnection,System.Data.OracleClient, Version=1.2.0.30714, Culture= neutral,PublicKeyToken=b32731d11ce58905] System.IO.FileLoadException: The located assembly's manifest definition with nam e 'System.Data.OracleClient' does not match the assembly reference. This means that the assembly specified in the config file for the OracleClient does not match the manifest of the System.Data.OracleClient.dll assembly found on disk. In the config file you have specified the ADO.NET provider to use as: System.Data.OracleClient.OracleConnection,System.Data.OracleClient, Version=1.2.0.30714, Culture=neutral,PublicKeyToken=b32731d11ce58905 The version number and public key are not correct for the System.Data.OracleClient assembly. Try the following: Version=1.0.3300.0 PublicKeyToken=b77a5c561934e089 If you still get the same error then you will need to find your System.Data.OracleClient assembly and find the correct version number and public key token from the file. You can get the version from the file properties dialog. To get the public key token you need to use sn.exe with the -t option. Sn.exe is shipped with the .net SDK in VisualStudio. Nicko File name: System.Data.OracleClient at System.Type.GetType(String typeName, Boolean throwOnError) at log4net.Appender.ADONetAppender.ResolveConnectionType() === Pre-bind state information === LOG: DisplayName = System.Data.OracleClient, Version=1.2.0.30714, Culture=neutra l, PublicKeyToken=b32731d11ce58905 (Fully-specified) LOG: Appbase = C:\hv\HF Security\Log4net\log4net-1.2.0-beta8\examples\net\1.0\Tu torials\ConsoleApp\cs\build\debug\ LOG: Initial PrivatePath = NULL Calling assembly : log4net, Version=1.2.0.30714, Culture=neutral, PublicKeyToken =b32731d11ce58905. === LOG: Publisher policy file is not found. LOG: Host configuration file not found. LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v1 .1.4322\config\machine.config. LOG: Post-policy reference: System.Data.OracleClient, Version=1.2.0.30714, Cultu re=neutral, PublicKeyToken=b32731d11ce58905 LOG: Attempting download of new URL file:///C:/hv/HF Security/Log4net/log4net-1. 2.0-beta8/examples/net/1.0/Tutorials/ConsoleApp/cs/build/debug /System.Data.Oracl eClient.DLL. WRN: Comparing the assembly name resulted in the mismatch: Minor Version -- --- The following is the ADONetAppender portion of my config file. Does anyone know what is wrong? -- -- appender name=ADONetAppender_Oracle type=log4net.Appender.ADONetAppender param name=ConnectionType value=System.Data.OracleClient.OracleConnection,System.Data.O racleClient, Version=1.2.0.30714, Culture=neutral,PublicKeyToken=b32731d11ce58905 / param name=ConnectionString value=data source=[netbltsdb1];User ID=[docex];Password=[docex] / param name=CommandText value=INSERT INTO Log (Datetime, Thread,Log_Level,Logger,Message) VALUES (:log_date,:thread,:log_level,:logger,:message) / param name=BufferSize value=128 / param name=Parameter param name=ParameterName value=:log_date / param name=DbType value=Date / param name=Layout type=log4net.Layout.RawTimeStampLayout / /param param name=Parameter param name=ParameterName value=:thread / param name=DbType value=String / param name=Size value=255 / param name=Layout type=log4net.Layout.PatternLayout param name=ConversionPattern value=%t / /param /param param name=Parameter param name=ParameterName value=:log_level / param name=DbType value=String / param name=Size value=50 / param name=Layout type=log4net.Layout.PatternLayout param name=ConversionPattern value=%p / /param /param param name=Parameter param name=ParameterName
RE: Error using ADONetAppender
Looking at the assembly with the file system properties and the sn.exe tool seems to be giving a different set of results to the .NET Reflector. The .NET Reflector (http://www.aisto.com/roeder/dotnet) thinks that the strong name for the assembly is: System.Data.OracleClient, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 I am not sure why this is different to the Public key token displayed by sn.exe. Try the above details. Also the System.Data.OracleClient references the following DLLs: mtxoci8.dll oci.dll oramts.dll I am assuming that these either come with the OracleClient or are part of the Oracle client tools for windows. These DLLs need to be located either in the windows system32 directory or the application bin directory for the Windows DLL loader to find them. Nicko -Original Message- From: Ping Xie [mailto:[EMAIL PROTECTED] Sent: 11 August 2004 16:23 To: Log4NET User Subject: RE: Error using ADONetAppender Nicko, Thank you very much for your response. I found out the version number and public key token of System.Data.OracleClient assembly and modified my configuration file. But I still got the same error. System.Data.OracleClient.dll is in C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322 directory of my machine. I had put this directory in the Path. I also tried to copy the dll to the application exe directory. It has the same result. I searched my machine. There is only one System.Data.OracleClient.dll. What else could be wrong? The following are my new config and result. Config -- --- appender name=ADONetAppender_Oracle type=log4net.Appender.ADONetAppender param name=ConnectionType value=System.Data.OracleClient.OracleConnection, System.Data.OracleClient, Version=1.1.4322.573, Culture=neutral, PublicKeyToken=350c7afdc4c296b5 / param name=ConnectionString value=data source=[proddevdatabase];User ID=[chris9];Password=[chris9] / param name=CommandText value=INSERT INTO Log (Datetime, Thread,Log_Level,Logger,Message) VALUES (:log_date,:thread,:log_level,:logger, :message) / param name=BufferSize value=128 / param name=Parameter .. -- --- Result -- -- log4net:ERROR [ADONetAppender] Failed to load connection type [System.Data.Oracl eClient.OracleConnection, System.Data.OracleClient, Version=1.1.4322.573, Cultur e=neutral, PublicKeyToken=350c7afdc4c296b5] System.IO.FileNotFoundException: File or assembly name System.Data.OracleClient, or one of its dependencies, was not found. File name: System.Data.OracleClient at System.Type.GetType(String typeName, Boolean throwOnError) at log4net.Appender.ADONetAppender.ResolveConnectionType() === Pre-bind state information === LOG: DisplayName = System.Data.OracleClient, Version=1.1.4322.573, Culture=neutr al, PublicKeyToken=350c7afdc4c296b5 (Fully-specified) LOG: Appbase = C:\hv\HF Security\Log4net\log4net-1.2.0-beta8\examples\net\1.0\Tu torials\ConsoleApp\cs\build\debug\ LOG: Initial PrivatePath = NULL Calling assembly : log4net, Version=1.2.0.30714, Culture=neutral, PublicKeyToken =b32731d11ce58905. === -- -- I appreciate it. Ping Xie CACI 4831 Walden Lane Lanham, MD 20706 [EMAIL PROTECTED] (301) 306-8200 - Main (301) 306-2829 - Direct Nicko Cadell [EMAIL PROTECTED] 08/11/2004 09:36 AM Please respond to Log4NET User To:Log4NET User log4net-user@logging.apache.org cc: Subject:RE: Error using ADONetAppender I'm try to log messages to Oracle database. I got the following debug errors when run my application. -- - log4net:ERROR [ADONetAppender] Failed to load connection type [System.Data.Oracl eClient.OracleConnection,System.Data.OracleClient, Version=1.2.0.30714, Culture= neutral,PublicKeyToken=b32731d11ce58905] System.IO.FileLoadException: The located assembly's manifest definition with nam e 'System.Data.OracleClient' does not match the assembly reference. This means that the assembly specified in the config file for the OracleClient does not match the manifest of the System.Data.OracleClient.dll assembly found on disk. In the config file you have specified the ADO.NET provider to use as: System.Data.OracleClient.OracleConnection,System.Data.OracleClient, Version
Error using ADONetAppender
Hi, I'm try to log messages to Oracle database. I got the following debug errors when run my application. --- log4net:ERROR [ADONetAppender] Failed to load connection type [System.Data.Oracl eClient.OracleConnection,System.Data.OracleClient, Version=1.2.0.30714, Culture= neutral,PublicKeyToken=b32731d11ce58905] System.IO.FileLoadException: The located assembly's manifest definition with nam e 'System.Data.OracleClient' does not match the assembly reference. File name: System.Data.OracleClient at System.Type.GetType(String typeName, Boolean throwOnError) at log4net.Appender.ADONetAppender.ResolveConnectionType() === Pre-bind state information === LOG: DisplayName = System.Data.OracleClient, Version=1.2.0.30714, Culture=neutra l, PublicKeyToken=b32731d11ce58905 (Fully-specified) LOG: Appbase = C:\hv\HF Security\Log4net\log4net-1.2.0-beta8\examples\net\1.0\Tu torials\ConsoleApp\cs\build\debug\ LOG: Initial PrivatePath = NULL Calling assembly : log4net, Version=1.2.0.30714, Culture=neutral, PublicKeyToken =b32731d11ce58905. === LOG: Publisher policy file is not found. LOG: Host configuration file not found. LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v1 .1.4322\config\machine.config. LOG: Post-policy reference: System.Data.OracleClient, Version=1.2.0.30714, Cultu re=neutral, PublicKeyToken=b32731d11ce58905 LOG: Attempting download of new URL file:///C:/hv/HF Security/Log4net/log4net-1. 2.0-beta8/examples/net/1.0/Tutorials/ConsoleApp/cs/build/debug/System.Data.Oracl eClient.DLL. WRN: Comparing the assembly name resulted in the mismatch: Minor Version - The following is the ADONetAppender portion of my config file. Does anyone know what is wrong? appender name=ADONetAppender_Oracle type=log4net.Appender.ADONetAppender param name=ConnectionType value=System.Data.OracleClient.OracleConnection,System.Data.OracleClient, Version=1.2.0.30714, Culture=neutral,PublicKeyToken=b32731d11ce58905 / param name=ConnectionString value=data source=[netbltsdb1];User ID=[docex];Password=[docex] / param name=CommandText value=INSERT INTO Log (Datetime, Thread,Log_Level,Logger,Message) VALUES (:log_date,:thread,:log_level,:logger,:message) / param name=BufferSize value=128 / param name=Parameter param name=ParameterName value=:log_date / param name=DbType value=Date / param name=Layout type=log4net.Layout.RawTimeStampLayout / /param param name=Parameter param name=ParameterName value=:thread / param name=DbType value=String / param name=Size value=255 / param name=Layout type=log4net.Layout.PatternLayout param name=ConversionPattern value=%t / /param /param param name=Parameter param name=ParameterName value=:log_level / param name=DbType value=String / param name=Size value=50 / param name=Layout type=log4net.Layout.PatternLayout param name=ConversionPattern value=%p / /param /param param name=Parameter param name=ParameterName value=:logger / param name=DbType value=String / param name=Size value=255 / param name=Layout type=log4net.Layout.PatternLayout param name=ConversionPattern value=%c / /param /param param name=Parameter param name=ParameterName value=:message / param name=DbType value=String / param name=Size value=4000 / param name=Layout type=log4net.Layout.PatternLayout param name=ConversionPattern value=%m / /param /param /appender Thank you in advance. Ping Xie CACI 4831 Walden Lane Lanham, MD 20706 [EMAIL PROTECTED] (301) 306-8200 - Main (301) 306-2829 - Direct