Logs and exceptions
After the system is deployed, administrators need a strong logging system to diagnose and fix configuration problems, which requires a set of ways to change logging through configuration. Experience has shown that the log module is often an important part of the software development cycle, Aicken has used a period of time log4net,log4net is a good log frame, but sometimes still feel a bit of a bad, for example, need to use different types of log records of different classes, The behavior of the method and different business behavior, sometimes need in the system runtime, change the recording media of a business log, etc., encounter these factors log4net may need to modify the code recompile, and Isline The Applogprovider module of the framework can only modify the configuration file to meet the requirements, it has the following advantages:
It provides an accurate environment for the application to run, which allows developers to quickly find bugs in the application;
Once the log output code is added to the program, the program can generate and output logs without human intervention in the course of operation.
Different log information can be exported to different places (consoles, files, databases, etc.) for future research purposes.
These two provider are developed on the basis of these requirements, which are responsible for recording the running logs and Run-time exceptions in the system, but the applogprovider of the Isline framework is more flexible and easy to use than log4net, and the advantages of using this module are as follows:
The render component defines the output media. As the name shows, these components attach them to the log component and pass the output to the output stream, which can attach a Appender component to multiple log objects.
Flexible control of the log level, after the deployment of the system, through the level of control, shortcut switch to record the information of a business block.
By setting up the log cache, the system centralizes the collection log and exception information of the resources, and writes the storage media efficiently after the threshold is reached.
Through the configuration file, you can quickly change the logging media (files, databases), record the technology used, do not need to change the program files, just change the configuration file.
Users can control the output of log information very precisely, reduce redundant information and improve logging performance. At the same time, through the external configuration file, users can change the application log behavior without recompiling the program, so that users can flexibly select the information to be recorded according to the situation.
In these two provider, there is a very important concept, is "Render", Render is a log exception module configuration node, which determines the system log records of the target, record way, path and other information, this information can be configured, it can be a database, text files, XML files , even the TV, but in addition to the database, file these built-in render, other recording media need to inherit the relevant interface, and then expand the implementation.
The provider currently has built-in support for logging in SQL SERVER, ORACLE, and text files, and can use SQL statements or stored procedures as a recording tool.
Render Introduction:
This is a render instance
<OracleUsingSPRender>
<AppenderStyle>Oracle</AppenderStyle>
<AppenderType>StoredProcedure</AppenderType>
<AppenderInf>IsLine.Data.Configuration.OracleConnectString</AppenderInf>
<AppenderContent>SP_ADD_ILFWLOG.ADD_ILFWLOG</AppenderContent>
<LayoutInf></LayoutInf>
<Level>Debug</Level>
</OracleUsingSPRender>
<OracleUsingSPRender></OracleUsingSPRender> for a render node, the render name in parentheses, and the default render are:
| Oracleusingsprender |
Logging with stored procedures for Oracle databases |
| Oracleusingtextrender |
Logging with SQL statements from an Oracle database |
| Sqlserverusingsprender |
Logging using stored procedures in SQL Server databases |
| Sqlserverusingtextrender |
Logging using SQL statements from SQL Server databases |
| Filerender |
Logging to a text file |
| Mailrender |
Send log to Recipient |