NET Logging Library
Database - ODBC
Basic Tasks > Database - ODBC

The OdbcTarget logs to an ODBC database.  It automatically discards oldest entries after reaching a default of 10,000 log messages.  This behavior can be overridden.  Although rolling is supported, the database table will need to be created manually.

The default table name is tblLog. Here are the column names and types:
LogDate OdbcType.DateTime
Message OdbcType.Text
Additional OdbcType.Text 
ElapsedMilliseconds OdbcType.Real
LogLevel OdbcType.VarChar
MachineName OdbcType.VarChar
UserName OdbcType.VarChar
ProcessName OdbcType.VarChar
CallingMethod OdbcType.VarChar
LineNumber OdbcType.VarChar

It has these properties that can be configured:


 

//Example runtime configuration, can also use log.config, app.config, or web.config
Log.ResetConfiguration();

OdbcTarget target = new OdbcTarget();
target.ConnectionString = @"ProviderDriver=SQLite3 ODBC Driver;Database=E:\sqlite.db;";
target.TableName = "LogTable";
//Set to zero to not discard max entries
target.MaxEntries = 10000;
Log.Config.Targets.Add(target);

Log.Debug("This is a test");