Log4J Settings (Repo) - OrderOfTheBee/ootbee-support-tools GitHub Wiki

The Log4J Settings tool provides various interactions with the Log4J logging system in place for the Alfresco Repository web application. It allows modification of logging threshold levels for all configured or specifically used loggers, tailing of the root logger (similar to tailing the default alfresco.log file) and access to log files via the web interface.

Log4J Settings tool

Add logger

It is possible to add a new logger to the list of configured / explicitly used loggers, and set a specific log level for the new logger. Other than via JMX or the official Alfresco Support Tools addon there is no requirement that the logger must have been already configured or used - it can be a completely arbitrary new one or on any intermediary level (e.g. parent package). Note: Though logger names are shown in an abbreviated form in the list of loggers, the full name (e.g. of a class / package) must always be used when defining a new logger.

Tail Repository Log

This button will open a continously refreshing dialog that shows log output that is directed to the appender of the root logger, similarly to the alfresco.log file. If any specific logger has been configured not to inherit the appender from its parent loggers, the log output of such logger will not be shown. It is possible to disable the automatic reloading of the log output and to alter the refresh interval. Output can be toggled between a table-based or a simple text rendering via the "TXT" button on the bottom right of the dialog.

The log tailing is performed by attaching a new appender dynamically to the root logger. It is not required to modify the Log4J configuration files for this feature to work, which would be the case in the official Alfresco Support Tools addon. The dynamically registered appender collects log events in heap memory (limited to 10000 entries) and will be automatically removed once log messages have not been refreshed for more than 20 minutes, which either happens if the automatic refresh is disabled or the dialog is closed.

Log4J Settings tail log

Repository Log Files

This button will open a dialog that allows access to all log files on the server that can be associated with configured Log4J loggers. This dialog allows to open or download individual log files, as well as download a ZIP of multiple log files. This feature has been developed with security in mind, and ít will not allow access to any file that cannot be traced back to a Log4J file appender - either a simple or rolling one. This also means that changing the Log4J configuration for appenders will directly affect the log files accessible via the dialog. If an appender log name pattern is modified, all log files written with the old pattern will become inaccessible even if they are still present on the server.

Log4J Settings log files

Loggers

By default the tool will list all the explicitly configured loggers in its display table. This table includes information about the identity of the parent logger (from which a logger may inherit appenders and log settings), its inheritance state and access to details about the effective appenders for the logger. The log level setting for each logger can be changed inline via the provided drop down list, providing all supported Log4J log levels and the meta-value of UNSET, which removes any explicit setting for this logger and results in the logger inheriting the log level from its parent. The column for effective value shows the log level that will currently be used for filtering log events - for any logger without the setting value UNSET it should show the same value as in the setting column.

The list of displayed loggers can be extended to show all loggers, showing also loggers that have been initialised through active code but that have not been explicitly configured in a configuration file or that have their log level set to the value of UNSET. Since there may be a large number of loggers in the Alfresco Repository - potentially expanded upon by any addon - the display of all loggers may take some time to load. Every time a change to a log level is made or a logger is added to the system, the current list will reload to ensure a consistent state.

The "Reset all" button allows to quickly reset the log values of all loggers to the state before the first change was applied using the Log4J Settings tool. All changes made via the tool are tracked in-memory and can be reset at any time. Any changes made by other means, e.g. JMX, are not recorded and may not be reset unless the same logger has also been modified via the Log4J Settings tool before.

Log Snapshot

The "Start log Snapshot" button allows to create a temporary log file to collect log statements between starting / stopping the snapshot session. This feature can be used to create simple log excerpts while reproducing an issue for reporting it to support staff. Once started, the snapshot session can be stopped via the "Stop log Snapshot" button (automatic stop after 20 minutes), which will also trigger the download of the log file contents. While the snapshot session is active, it is possible to add arbitrary log statements to the log in order to add demarcation points e.g. for various steps involved in reproducing an issue.

Note: The snapshot session is associated with the current browser tab - leaving or reloading the page will result in the association to be lost.