Logging of error messages in the database

From version 2.1, the logs of the FSM can also be saved in the database and thus called up directly in the FSM.

The next time the FSM is started, the DBTransformer automatically adds the "Protocol_Web" table in which the logs can be saved.

Set up logging in database

For newly installed systems from version 2.1, the DB logger is automatically included in the "innoconfig.xml". Older systems that are updated to version 2.1 must first change their "innoconfig.xml" so that the logs can also be saved in the database.

You can either obtain the new innoconfig from the FSM release folder (\\fileserver\Releases\dotnet\FSM) and adapt it to your own database again, as described in this article.

Alternatively, you can edit the existing innoconfig. To do this, add the following appender (expand DB appender code block) within the <log4net> tags (e.g. at position 1 in the screenshot).

DB-Appender
<appender name="DB" type="log4net.Appender.AdoNetAppender">
<connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<commandText value="INSERT INTO PROTOCOL_WEB ([Date_UTC],[Level],[Logger],[Message], [Exception]) VALUES (@log_date, @log_level, @logger, @message, @exception)" />
<bufferSize value="1" />
<parameter>
<parameterName value="@log_date" />
<dbType value="DateTime" />
<layout type="log4net.Layout.PatternLayout" value="%utcdate{yyyy'-'MM'-'dd HH':'mm':'ss'.'fff}" />
</parameter>
<parameter>
<parameterName value="@log_level" />
<dbType value="String" />
<size value="50" />
<layout type="log4net.Layout.PatternLayout" value="%level" />
</parameter>
<parameter>
<parameterName value="@logger" />
<dbType value="String" />
<size value="255" />
<layout type="log4net.Layout.PatternLayout" value="%logger" />
</parameter>
<parameter>
<parameterName value="@message" />
<dbType value="String" />
<size value="-1" />
<layout type="log4net.Layout.PatternLayout" value="%message" />
</parameter>
<parameter>
<parameterName value="@exception"/>
<dbType value="String"/>
<size value="-1" />
<layout type="log4net.Layout.PatternLayout" value="%exception"/>
</parameter>
</appender>

images/download/attachments/494473292/Appender_einfuegen_Pfeil.png


Then add a reference to this appender between the <root> tags:

Referenz auf Appender
<root>
<level value="ERROR" />
<appender-ref ref="DB" /> <!--Diese Zeile hinzufügen-->
<appender-ref ref="File" />
</root>

Setting the log level

In "innoconfig.xml" you can set the point at which events are logged.

There are 6 different levels for this:

Logstufe

Beschreibung

ALL

All messages that are recorded

DEBUG

Debug messages for developers

INFO

Information about the course of the program

WARN

Warnings that could possibly cause errors

ERROR

Error during the execution of functions

FATAL

Critical errors

The upper levels also contain all logs from the levels below. At log level "WARN", for example, messages from levels "WARN", "ERROR" and "FATAL" are logged.

It is recommended to leave the setting at "ERROR" during normal operation. Higher log levels produce significantly more log entries and therefore consume more performance and memory.

Activate/deactivate logging types

Both logging types are activated by default. To deactivate one type, you can comment out the corresponding reference in the <root> tag of innosoft.xml. The commented-out block begins in XML with <!-- and ends with -->

In the following example, logging is deactivated in the database:

Deaktivierter DB-Logger
<root>
<level value="ERROR" />
<!--<appender-ref ref="DB" />-->
<appender-ref ref="File" />
</root>

To reactivate the logger, simply remove the comment again.

Setting the storage duration of logs

As an admin, you can configure how long logs are retained in the database in the settings under images/download/thumbnails/494470693/Administration_men%C3%BC_img.png and images/download/thumbnails/494471117/Allgemeine-Einstellungen_EN_img.png .

In the images/download/thumbnails/494469533/Allgemein-Allgemeine-Einstellungen_EN_img.png section, activate the automatic deletion of old error logs by checking the box next to "Error log deletion activated". Directly below, under "Delete automatically after [days]", you can specify when error logs are to be counted as old and deleted during the hourly check.