Difference between revisions of "Logging"
(Created page with "Internal, system driven events of different types (debug messages, errors, warnings, etc.) occuring within in {{UBIK}} are recorded by a logging mechanism. This information su...") |
|||
(7 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | Internal, system driven events of different types (debug messages, errors, warnings, etc.) | + | Internal, system-driven events of different types (debug messages, errors, warnings, etc.) occurring within {{UBIK}} are recorded by a logging mechanism. This information supports the user in finding issues in the design process or identifying the reasons for problems at runtime. The mechanisms can be configured for the [[Web Service]], the {{UBIK Studio}} as well as for the {{UBIK Enterprise Service}}. A general description of the technique used can be found on the Microsoft page for [http://msdn.microsoft.com/en-us/library/ms733830%28v=vs.110%29.aspx Configuring Services]. |
− | Since {{Version/Server|2.4.3}} the configuration has to be done in the [[Configuration_Files/Logging.config|Logging.config]] file. For older versions the configuration has to be done in one of the main | + | == Version 3.6 == |
+ | |||
+ | * With Version 3.6 we Replaced our existing Microsoft.Practices.EnterpriseLibrary.Logging with more up-to-date solutions like Serilog. | ||
+ | |||
+ | === What is Serilog === | ||
+ | Serilog is a portable and structured logging framework to record diagnostic logs into files, consoles, and SQL/NoSQL databases. | ||
+ | |||
+ | ===Serilog existing log event levels=== | ||
+ | *Log Levels are taken from the Serilog doku : https://github.com/serilog/serilog/wiki/Configuration-Basics | ||
+ | {| class="wikitable sortable" | width = "50%" | ||
+ | |- | ||
+ | ! LogLevel !! Purpose | ||
+ | |- align="left" | ||
+ | | Verbose ||It is the noisiest level, generally used only as a last resort when debugging a difficult problem, and rarely (if ever) enabled for a production app. For example, local variables within an algorithm implementation might be logged at this level. | ||
+ | |- align="left" | ||
+ | | Debug || Debug is used for internal system events that are not necessarily observable from the outside, but useful when determining how something happened. For example, the details of requests and responses made to and from external integration points would often be logged at this level. | ||
+ | |- align="left" | ||
+ | | Information || Information events describe things happening in the system that corresponds to its responsibilities and functions. Generally, these are the observable actions the system can perform. For example, processing a payment or updating a user's details will be logged at this level. | ||
+ | |- align="left" | ||
+ | | Warning || When service is degraded, endangered or may be behaving outside of its expected parameters, Warning level events are used. A warning event should only be emitted when the condition is either transient or can be investigated and fixed - use restraint to avoid polluting the log with spurious warnings. For example, slow response times from a critical database would be logged as warnings. | ||
+ | |- align="left" | ||
+ | | Error || When functionality is unavailable or expectations are broken, an Error event is used. For example, receiving an exception when trying to commit a database transaction is an event at this level. | ||
+ | |- align="left" | ||
+ | | Fatal || The most critical level, Fatal events demand immediate attention. For example, an application failing during startup will log a Fatal event. If you have a pager, it goes off when one of these occurs. | ||
+ | |- align="left" | ||
+ | |} | ||
+ | |||
+ | ===Logging methods used in UBIKKernel=== | ||
+ | {| class="wikitable sortable" | width = "50%" | ||
+ | |- | ||
+ | ! MethodName !! Level !! Purpose | ||
+ | |- align="left" | ||
+ | | LogVerbose || Verbose || method for writing a verbose log message to the output log file logged as Verbose event level. (new) | ||
+ | |- align="left" | ||
+ | | LogDebugOutput || Debug || method for writing a debug log message to the output log file logged as Debug event level. | ||
+ | |- align="left" | ||
+ | | LogInformation || Information || method for writing an information log message to the output log file logged as Information event level. (new) | ||
+ | |- align="left" | ||
+ | | LogSQLStatement LogSQLCommand || Information || method for writing a SQL log message to the output log file logged as Information event level. | ||
+ | |- align="left" | ||
+ | | LogCustomizing || Information || method for writing a customizing log message to the output log file logged as Information event level. | ||
+ | |- align="left" | ||
+ | | LogService || Information || method for writing a customizing log message to the output log file logged as Information event level. | ||
+ | |- align="left" | ||
+ | | LogWorkflowOutput || Information || method for writing a service log message to the output log file logged as Information event level. | ||
+ | |- align="left" | ||
+ | | ThrowAssertion || Warning || method for writing an assertion log message to the output log file logged as Information event level. | ||
+ | |- align="left" | ||
+ | | LogWarning || Warning || method for writing a warning log message to the output log file logged as Warning event level. | ||
+ | |- align="left" | ||
+ | | LogError || Error || method for writing an error log message to the output log file logged as Error event level. (new) | ||
+ | |- align="left" | ||
+ | | LogException || Error || method for writing an exception log message to the output log file logged as Error event level. | ||
+ | |- align="left" | ||
+ | | LogFatal || Fatal || method for writing a fatal log message to the output log file logged as Fatal event level. (new) | ||
+ | |- align="left" | ||
+ | |} | ||
+ | |||
+ | === How To Configure Logging === | ||
+ | |||
+ | *Added a way for the User to configure the default log path, the file count limit, the log event level, and rolling policies through Logger.config with changing only the “values”, which are set on their default. | ||
+ | **The default Log path is set to the installation directory of UBIK. Its value can be changed to any local path (e.g. value="C:\logs"). | ||
+ | **Using OS Environment Variables (e.g. value="%SYSTEMDRIVE%\logs") is possible. | ||
+ | **Using Relative path's (e.g. value="..\logs" used for moving up in the hierarchy from the current directory) or (e.g. value=".\logs" represents the current directory itself) is possible. | ||
+ | **The default for the event level is set to Debug and its values can be changed to Verbose, Information, Warning, Error, or Fatal. | ||
+ | *File default count limit is set to 31 and its values can be changed to any positive number. | ||
+ | *The default Rolling policies are set to Day and its values can be changed to "Day", "Month" or "Year". | ||
+ | |||
+ | <source lang="xml"> | ||
+ | |||
+ | <LoggingConfiguration> | ||
+ | <add key="LogRootPath" value=""/> | ||
+ | <!-- Values can be "Verbose", "Debug", "Information", "Warning", "Error", "Fatal". Normally "Debug" should be fine and you should only change it if you know well what you do. --> | ||
+ | <add key="LogLevel" value="Debug"/> | ||
+ | <!-- The most recent 31 files are retained by default (i.e. one long month). If the value is empty the default will be applied. You must specifically set value="null" to remove this limit and all log files will be kept. You can set any other positive number --> | ||
+ | <add key="RetainedFileCountLimit" value="31"/> | ||
+ | <!-- Value can be either "Day", "Month" or "Year". Default is "Day"--> | ||
+ | <add key="RollingInterval" value="Day"/> | ||
+ | </LoggingConfiguration> | ||
+ | |||
+ | </source> | ||
+ | |||
+ | |||
+ | |||
+ | <!-- DO NOT REMOVE THIS -->{{Template:Activity/End}}<!-- DO NOT REMOVE THIS --> | ||
+ | |||
+ | |||
+ | == Version 3.5 or erlier == | ||
+ | |||
+ | Since {{Version/Server|2.4.3}} the configuration has to be done in the [[Configuration_Files/Logging.config|Logging.config]] file. For older versions the configuration has to be done in one of the main [[Configuration_Files|configuration files]]. | ||
+ | |||
+ | ===How to configure logging Version 3.5 or erlier=== | ||
+ | * [[Configuration_Files/Logging.config]] | ||
+ | * [[HowTo:Configure_Logging]] | ||
==Logging categories== | ==Logging categories== | ||
− | {{UBIK}} has different types of categories configured for the logging mechanism. The following categories can be configured in the configuration files. Categories with the remark '''internal''' are available via customizing code | + | {{UBIK}} has different types of categories configured for the logging mechanism. The following categories can be configured in the configuration files. Categories with the remark '''internal''' are available via customizing code but are used to log internal events. As it is not recommended to mix logging of internal events together with others, the two additional categories '''CUSTOMIZING''' and '''WORKFLOW''' have been created. |
{| class="wikitable" | width = "88%" | {| class="wikitable" | width = "88%" | ||
Line 11: | Line 104: | ||
! Type!! Description!! Access | ! Type!! Description!! Access | ||
|- | |- | ||
− | | CUSTOMIZING || Log for events that | + | | CUSTOMIZING || Log for events that occurred in the customizing. This method is available by calling <code>UBIKKernel.LogCustomizing(...)</code> from the customizing code. || public |
|- | |- | ||
− | | WORKFLOW || Log for events that | + | | WORKFLOW || Log for events that occurred when running workflows which are provided by the [[WriteLogEntry_(Activity)|WriteLogEntry Activity]] || public |
|- | |- | ||
| ASSERTION || Log for failed Assertions || internal | | ASSERTION || Log for failed Assertions || internal | ||
Line 28: | Line 121: | ||
|- | |- | ||
|} | |} | ||
+ | |||
+ | == How To Configure Logging for EnterpriseService == | ||
+ | |||
+ | When creating UBIK.Studio in Windows, the right for the application packages is not available in the standard case and must be added manually. | ||
+ | This can be done by right-clicking on the UBIK.Studio folder and under the security tab the rights for the application package can be manually added. | ||
+ | |||
+ | == See also == | ||
+ | * [[HowTo:Configure_Logging]] | ||
+ | * [[Configuration_Files]] | ||
+ | * [[Serilog]] | ||
+ | |||
+ | {{Category/Version|3.6.0}} | ||
+ | |||
+ | [[Category:3.6.0|Logging]] | ||
+ | [[Category:Installing|Logging]] | ||
+ | [[Category:Server|Logging]] | ||
+ | [[Category:Web service|Logging]] |
Latest revision as of 07:49, 1 September 2022
Internal, system-driven events of different types (debug messages, errors, warnings, etc.) occurring within UBIK® are recorded by a logging mechanism. This information supports the user in finding issues in the design process or identifying the reasons for problems at runtime. The mechanisms can be configured for the Web Service, the UBIK® Studio as well as for the UBIK® Enterprise Service. A general description of the technique used can be found on the Microsoft page for Configuring Services.
Contents
Version 3.6
- With Version 3.6 we Replaced our existing Microsoft.Practices.EnterpriseLibrary.Logging with more up-to-date solutions like Serilog.
What is Serilog
Serilog is a portable and structured logging framework to record diagnostic logs into files, consoles, and SQL/NoSQL databases.
Serilog existing log event levels
- Log Levels are taken from the Serilog doku : https://github.com/serilog/serilog/wiki/Configuration-Basics
LogLevel | Purpose |
---|---|
Verbose | It is the noisiest level, generally used only as a last resort when debugging a difficult problem, and rarely (if ever) enabled for a production app. For example, local variables within an algorithm implementation might be logged at this level. |
Debug | Debug is used for internal system events that are not necessarily observable from the outside, but useful when determining how something happened. For example, the details of requests and responses made to and from external integration points would often be logged at this level. |
Information | Information events describe things happening in the system that corresponds to its responsibilities and functions. Generally, these are the observable actions the system can perform. For example, processing a payment or updating a user's details will be logged at this level. |
Warning | When service is degraded, endangered or may be behaving outside of its expected parameters, Warning level events are used. A warning event should only be emitted when the condition is either transient or can be investigated and fixed - use restraint to avoid polluting the log with spurious warnings. For example, slow response times from a critical database would be logged as warnings. |
Error | When functionality is unavailable or expectations are broken, an Error event is used. For example, receiving an exception when trying to commit a database transaction is an event at this level. |
Fatal | The most critical level, Fatal events demand immediate attention. For example, an application failing during startup will log a Fatal event. If you have a pager, it goes off when one of these occurs. |
Logging methods used in UBIKKernel
MethodName | Level | Purpose |
---|---|---|
LogVerbose | Verbose | method for writing a verbose log message to the output log file logged as Verbose event level. (new) |
LogDebugOutput | Debug | method for writing a debug log message to the output log file logged as Debug event level. |
LogInformation | Information | method for writing an information log message to the output log file logged as Information event level. (new) |
LogSQLStatement LogSQLCommand | Information | method for writing a SQL log message to the output log file logged as Information event level. |
LogCustomizing | Information | method for writing a customizing log message to the output log file logged as Information event level. |
LogService | Information | method for writing a customizing log message to the output log file logged as Information event level. |
LogWorkflowOutput | Information | method for writing a service log message to the output log file logged as Information event level. |
ThrowAssertion | Warning | method for writing an assertion log message to the output log file logged as Information event level. |
LogWarning | Warning | method for writing a warning log message to the output log file logged as Warning event level. |
LogError | Error | method for writing an error log message to the output log file logged as Error event level. (new) |
LogException | Error | method for writing an exception log message to the output log file logged as Error event level. |
LogFatal | Fatal | method for writing a fatal log message to the output log file logged as Fatal event level. (new) |
How To Configure Logging
- Added a way for the User to configure the default log path, the file count limit, the log event level, and rolling policies through Logger.config with changing only the “values”, which are set on their default.
- The default Log path is set to the installation directory of UBIK. Its value can be changed to any local path (e.g. value="C:\logs").
- Using OS Environment Variables (e.g. value="%SYSTEMDRIVE%\logs") is possible.
- Using Relative path's (e.g. value="..\logs" used for moving up in the hierarchy from the current directory) or (e.g. value=".\logs" represents the current directory itself) is possible.
- The default for the event level is set to Debug and its values can be changed to Verbose, Information, Warning, Error, or Fatal.
- File default count limit is set to 31 and its values can be changed to any positive number.
- The default Rolling policies are set to Day and its values can be changed to "Day", "Month" or "Year".
<add key="LogRootPath" value=""/>
<!-- Values can be "Verbose", "Debug", "Information", "Warning", "Error", "Fatal". Normally "Debug" should be fine and you should only change it if you know well what you do. -->
<add key="LogLevel" value="Debug"/>
<!-- The most recent 31 files are retained by default (i.e. one long month). If the value is empty the default will be applied. You must specifically set value="null" to remove this limit and all log files will be kept. You can set any other positive number -->
<add key="RetainedFileCountLimit" value="31"/>
<!-- Value can be either "Day", "Month" or "Year". Default is "Day"-->
<add key="RollingInterval" value="Day"/>
</LoggingConfiguration>
Version 3.5 or erlier
Since Version 2.4.3 - Server the configuration has to be done in the Logging.config file. For older versions the configuration has to be done in one of the main configuration files.
How to configure logging Version 3.5 or erlier
Logging categories
UBIK® has different types of categories configured for the logging mechanism. The following categories can be configured in the configuration files. Categories with the remark internal are available via customizing code but are used to log internal events. As it is not recommended to mix logging of internal events together with others, the two additional categories CUSTOMIZING and WORKFLOW have been created.
Type | Description | Access |
---|---|---|
CUSTOMIZING | Log for events that occurred in the customizing. This method is available by calling UBIKKernel.LogCustomizing(...) from the customizing code. |
public |
WORKFLOW | Log for events that occurred when running workflows which are provided by the WriteLogEntry Activity | public |
ASSERTION | Log for failed Assertions | internal |
WARNING | Log for events that created a warning | internal |
ERROR | Log for events that created an error | internal |
DEBUG | Log for events that have to be investigated in the development | internal |
SQL | Log for events related to SQL queries | internal |
EXCEPTION | Log for events that caused an exception | internal |
How To Configure Logging for EnterpriseService
When creating UBIK.Studio in Windows, the right for the application packages is not available in the standard case and must be added manually. This can be done by right-clicking on the UBIK.Studio folder and under the security tab the rights for the application package can be manually added.