The FirebirdTarget uses and ODBC connection string to connect to your Firebird database. It automatically creates a logging table on startup with the name of tblLog if it does not exist. It automatically discards oldest entries after reaching a default of 10,000 log messages. This behavior can be overridden.
It has these properties that can be configured:
- Name - Defaults to FirebirdTarget
- LoggingMode - Defines which mode to use for the target; Synchronous, Buffered, or Asynchronous. The default is Synchronous.
- MessageFormat - What to output in the log. See the Message Format topic for more information.
- DateFormat - The date format for the %LogTime% variable in the MessageFormat. See the Date Format topic for more information.
- MinimumLevel - The minimum logging level to log a message.
- AssemblyNameFilter - If specified, only log for a specific assembly name. See the Filtering topic.
- NamespaceFilter - If specified, only log for a specific namespace. See the Filtering topic.
- ClassNameFilter - If specified, only log for a specific class name. See the Filtering topic.
- MethodNameFilter - If specified, only log for a specific method name. See the Filtering topic.
- ThreadNameFilter - If specified, logging will only occur for the thread id or thread name specified. See the Filtering topic.
- UserNameFilter - If specified, logging will only occur for the specific user name. See the Filtering topic.
- MachineNameFilter - If specified, logging will only occur for the specific machine name. See the Filtering topic.
- BufferSize - When a logging target has a Mode of Buffered, this is how often messages are committed. See the Buffered Logging topic.
- ConnectionString - Get or set the connection string.
- TableName - Get or set the table name. Defaults to tblLog
- MaxEntries - Discard the oldest entries that are greater than MaxEntries. Set to zero to disable.
- AutoCreateTable - If true, the logging table will be automatically created if it does not exist when the first message is logged.
tblLog Columns (Automatically Created)
LogID BIGINT NOT NULL
LogDate DATE
Message VARCHAR(8000)
Additional VARCHAR(8000)
ElapsedMilliseconds FLOAT
LogLevel VARCHAR(50)
MachineName VARCHAR(100)
UserName VARCHAR(100)
ProcessName VARCHAR(100)
CallingMethod VARCHAR(255)
LineNumber VARCHAR(100)
//Example runtime configuration, can also use log.config, app.config, or web.config
Log.ResetConfiguration();
FirebirdTarget target = new FirebirdTarget();
target.ConnectionString = @"DRIVER=Firebird/InterBase(r) driver;UID=SYSDBA;PWD=masterkey;DBNAME=E:\FIREBIRD.FDB;";
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");