Configure System Settings - Logging
Validation Authority records messages about system events on the system console, and log files which gets rolled over on daily basis through logging mechanism provided by Log4j2. This logging mechanism helps to segregate the logs on date wise to easily identify the logs. Each system event has severity level that specifies how important is the message. The severity log levels are, Fatal, Error, Warn, Info, Debug, and Trace in order of decreasing severity.
Validation Authority stores log files in the <Install directory\authority\logs> directory. To view these logs in VA console, click the logs link in the Administrator section.
You can configure the types of log messages that are recorded using log4j2.xml file located in the <Install directory\ authority\server\WEB-INF\lib> directory. The log4j2.xml file have information about the log file levels, log file name, and rollover log file name.
To set the log levels, open the log4j2.xml file and modify the log levels as per your requirement. The VA server services needs to be restarted after the change.
Default contents of log4j2 xml file
The default name for the log file is va.log and default name for the rollover log file is va.%d (dd-MMM-yyyy).log.gz. However, the filename and filepattern can be configured in the log4j2.xml file to the log file name and rollover log file name.
For Example:
Log File name: va.log
Rollover log file name: va.01-Dec-2021.log.gz
The default log level is “info”.
<Root level="info">
To change the va.log file log level, configure the below line of script in the log4j2.xml file:
<AppenderRef ref="RollingFileAppender" level="write_your_level_here"/>
To change the number of log events to be listed in the logging email, configure the below line of script in the log4j2.xml file:
<EmailAppender name = "EmailLogAppender" recipient="" smtpHost="" sender="" subject="" bufferSize="10">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} [%t] %-5p - %msg%n"/>
</EmailAppender>
To change the "Administration Operations - CONSOLE" log level, configure the below line of script in the log4j2.xml file:
<AppenderRef ref="ListAppender" level="write_your_level_here"/>
Configure Email Logging
This section describes procedure to configure Email Logging using log4j2.xml file. The Email Logging triggers sending an email whenever an error/fatal event is occurred.
To configure the Email Logging, perform the following:
-
Open the log4j2.xml file located in the <Install directory\ authority\server\WEB-INF\lib> directory.
-
By default, the log4j2.xml file contains codes for Email Logging.
Key Parameters used for Email Logging in log4j2.xml file:
Parameter | Type | Description |
---|---|---|
name | String |
The name of the Appender. The Email Appender is used for the Email Logging which allows server to send an e-mail to you when a specific logging event occurs, typically on errors. For Example: EmailAppender name=”EmailLogAppender” |
recipient | String | The email address (or addresses) to which logging email(s) are sent. To specify more than one recipient, separate the addresses with commas. |
smtpHost | String | The SMTP server hostname or IP address used to send logging email. |
sender | String | The email address from which logging email will be sent. |
subject | String |
The subject used in logging emails. For Example: subject=”Error Log VA” |
bufferSize | integer |
The maximum limit for grouping log events in a single logging email is set to ensure efficient delivery and readability. Log events exceeding this threshold may be split into multiple emails for better management. The default value is 10. |
level | String |
This controls the severity of messages included in the email along with the error or fatal event i.e., the level of log messages (trace, debug, info, and warn) to be emailed. The default value is info. For Example: AppenderRef ref=”EmailLogAppender” If the level is set to “info”, and an error event is triggered, the email will include info and warn events along with the error event. If the level is set to “trace”, and an error event is triggered, the email will include trace, debug, info, and warn events along with the error event. |
Refer https://logging.apache.org/log4j/log4j-2.1/manual/appenders.html#SMTPAppender for more details about parameters used for Email Logging.