Configuring Logging

Sometimes it’s necessary to get detailed information about the running application or get additional data for problem analysis. This chapter describes how logging can be configured to get this information.

IMPORTANT: If you enable DEBUG level on the top packages a lot of debug information will be produced and such detailed logging can slow down the application significantly. The TRACE log level produces even more information. Use this configuration only when needed and always try to set more specific packages (to be logged). Do not use detailed debug logging in production environment for a long time and dispose of produced log information appropriately (log data might contain sensitive information).

Logging in DirX Audit Manager (REST)

The DirX Audit Manager application uses the Ngx-logger logging Angular library.
The configuration file location is:

install_path/web/audit-manager-tenantID/plugins/dirx-dxt-app-manager/assets/config/app-config.json

This file is in the JSON format. You can define log level by attribute common.logLevel. The level is an integer value that defines the log level for the application. The log level is used to filter the messages that are logged by the application. The lower the number, the more detailed the logging will be. The higher the number, the less detailed the logging will be. The set of possible levels contains: 0 – ALL, 1 – TRACE, 2 – DEBUG, 3 – INFO, 4 – WARN, 5 – ERROR, 6 – FATAL and 7 – OFF. The default value is 4 – WARN. There is an example of the configuration file with the DEBUG log level:

{
  …
  "common": {
    "logLevel": 2
  }
  …
}

The application logs messages to the browser console. You can view these messages on the Console tab in the browser developer tools.

Collecting Browser Diagnostic Information

Browser diagnostic information helps us analyze problems in DirX Audit Manager, such as application errors, unexpected user interface behavior and failed or slow REST requests. The console log records application messages and client-side errors, while a HAR file records network requests, responses, status codes and timing information. Collect both files while reproducing a problem to provide the relevant information for troubleshooting.

Collecting Console Logs

You can preserve and save the console log as follows:

  1. Open the browser developer tools and select the Console tab.

  2. Enable Preserve log / Keep log to retain messages when you navigate to another page or reload the application.

  3. Clear the existing messages, reproduce the problem and wait until the relevant messages appear.

  4. Right-click in the console output and select Save as to store the log in a text file. Depending on the browser, you can also select and copy all messages into a text file.

Working with HAR Files

You can use an HTTP Archive (HAR) file to store the network requests and responses recorded by the browser:

  1. Open the browser developer tools and select the Network tab.

  2. Enable Preserve log / Keep log and make sure that network recording is active.

  3. Clear the existing requests, reproduce the problem and wait until all relevant requests are complete.

  4. Select Export HAR or right-click the request list and select Save all as HAR with content to store the recording in a HAR file.

  5. To open a stored recording, select Import HAR on the Network tab or drag the HAR file into the request list. The imported requests then appear in the request list for analysis.

Console logs and HAR files can contain sensitive information, such as user data, request parameters, cookies and authentication tokens. Review the files and remove sensitive information before sharing them.

Logging in DirX Audit Server

DirX Audit Server uses Log4j 2 (running in the Spring Boot container) for logging.
The configuration file location is:

install_path/server_container/tenants/tenantID/conf/log4j2.properties

This file contains configuration in common Log4j 2 properties format.

To generate DEBUG messages for the DirX Audit Server application into the default log file, uncomment or set (create/update) the following loggers:

logger.solutions-dirx-audit.name = solutions.dirx.audit
logger.solutions-dirx-audit.level = DEBUG

If you need more fine-grained logging, you can adjust the packages in the loggers (to a more specific package) or change the log level (for example, to TRACE).

DirX Audit Server stores logging messages in the default files:

  • install_path/server_container/tenants/tenantID/logs/dirxaudit-server.log

  • install_path/server_container/tenants/tenantID/logs/dirxaudit-server-errors.log. This file only stores error log messages and thus serves as a backup of error messages, which can be lost in the default file as the result of logging rollover.

Changes after saving the configuration file are applied automatically after a time period defined by the configuration key and value expires. For example:

monitorInterval = 10

The value is defined in seconds and is set to 10 seconds as the default.

Logging in DirX Audit Message Broker

DirX Audit Message Broker uses Log4j 2 (running in Apache ActiveMQ container) for logging.
The configuration file location is:

install_path/message_broker/conf/log4j2.properties

This file contains configuration in common Log4j 2 properties format.

If you need more fine-grained logging saved into the default log file
(install_path/message_broker/data/activemq.log), you can adjust the log level
(for example, to TRACE).

Changes after saving the configuration file are not applied automatically: you must restart the DirX Audit Message Broker service to apply the changes.

Logging in Tools

DirX Audit command-line tools use Java util logging API (integrated in JVM) for logging.

To enable debug logging in command-line tools (located in install_path/tools/) add a parameter -debug to the command. (This does not apply to the management_checkjmx tool)

Examples:

install_path/tools/db_fact_population/bin/dxtPopulateFacts -debug

install_path/tools/db_maintenance/bin/dxtdbtool export -dstdir outdir -debug

See the chapter “Using the DirX Audit Tools” in the DirX Audit Command Line Interface Guide for detailed tool usage.

The generated log file (the name contains the selected action and timestamp) is located in install_path/tools/tool_name/log/.

If you need more detailed or more fine-grained logging, you can directly modify the logging configuration file install_path/tools/tool_name/app/logging.properties.

To generate logging messages for the specific DirX Audit tool, uncomment or set the respective loggers with the required log level in this file.

This file is a simplified configuration file (in Java properties format), for details see the Java util logging documentation.