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 "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. Uncomment the following lines of code to enable Email Logging:
<!-- <SMTP name="EmailLogging" subject="Error Log VA" to="" from="" smtpHost="" smtpPort="25" bufferSize="25"> <PatternLayout> <Pattern>%d{yyyy-MM-dd HH:mm:ss} [%t] %-5p - %msg%n</Pattern> </PatternLayout> </SMTP> -->
and
<!-- <AppenderRef ref="EmailLogging" level="info"/> -->
Key Parameters used for Email Logging in log4j2.xml file:
Parameter | Type | Description |
---|---|---|
name | String |
The name of the Appender. The Simple Mail Transfer Protocol (SMTP) Appender is used for the Email Logging which allows SMTP server to send an e-mail to you when a specific logging event occurs, typically on errors. For Example: SMTP name=”EmailLogging” |
subject | String |
The subject used in logging emails. For Example: subject=”Error Log VA” |
to | String | The email address (or addresses) to which logging email(s) are sent. To specify more than one recipient, separate the addresses with commas. |
from | String | The email address from which logging email will be sent. |
smtpHost | String | The SMTP host name used to send logging email. |
smtpPort | integer | The SMTP server port used to send logging email. The default value is 25. |
bufferSize | integer | The maximum number of log events to be listed in the logging email along with error/fatal event. The default value is 25. |
level | String |
This controls the severity of messages that are included in the email along with the error/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=”EmailLogging”level=”info” If level set to “info” and when an error event is triggered, log events – info and warn events will be included in the email along with the error event. If level set to “trace” and when an error event is triggered, log events – trace, debug, info and warn events will be included in the email 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.