Skip to content

API Library Log

Robert Polak edited this page Aug 9, 2019 · 12 revisions

Home / API Library / Log

API Library Log use for Logging application events. API Library Log implement the Log4Net. The API Library Log Methods list with Parameters.

  • Details about the Apache Log4Net framework at Log4Net

Configuration Log4Net

More details about The Server API Library Configuration at Configuration API - LOGGING - Log4Net


Instance

Send an Log by using the default template. Returns void

Method: API.Log.Instance

Parameters: N/A

Name Type Default Description
template String Properties.Resources.Log default template

Return: ILog


Levels of Logging

Logging code Logging Level Scope
Log.Instance.Info Info API Library
Log.Instance.Fatal Fatal API Library
Log.Instance.Debug Debug Application
Log.Instance.Error Error Application

Threshold of Logging

Debug TD UAT LIVE
File (FileAppender) ALL ALL ERROR ERROR
SMTP (SmtpAppender) OFF OFF ERROR ERROR
ADO (AdoNetAppender) ALL ALL ERROR ERROR

API Library Log - Usage examples

   Log.Instance.Info("SQL Server Connection Name: " + connectionName);
   Log.Instance.Debug("No data found");
   Log.Instance.Fatal("Fatal error found"); 
   Log.Instance.Error("Error found"); 

API Library Log - appender Logging to Database ConfigurationOK

API Library Log Logging event can be written to Database as see Configuration of Log variables at App.config section <appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender">. To use this appender configuration is required to run script on database to create TD_LOGGING table as listed below:

CREATE TABLE [dbo].[TD_LOGGING](
	[LGG_ID] [bigint] IDENTITY(1,1) NOT NULL,
	[LGG_DATETIME] [datetime] NOT NULL,
	[LGG_THREAD] [varchar](8) NOT NULL,
	[LGG_LEVEL] [varchar](8) NOT NULL,
	[LGG_CLASS] [varchar](256) NULL,
	[LGG_METHOD] [varchar](256) NULL,
	[LGG_LINE] [varchar](8) NULL,
	[LGG_MESSAGE] [nvarchar](max) NULL,
	[LGG_EXCEPTION] [nvarchar](max) NULL,
 CONSTRAINT [PK_TD_LOGGING] PRIMARY KEY CLUSTERED 
(
	[LGG_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO