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

Reply via email to