Skip to content

Log4J Settings (Share)

Axel Faust edited this page Sep 17, 2017 · 1 revision

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

Log4J Settings tool

Add logger

It is possible to add a new logger and set a specific log level for the new logger. 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 Share / Repository Log

This button will open a continously refreshing list that shows log output directed to the appender of the root logger, similarly to the share.log / 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.

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. 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

Share / 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 Alfresco Share or 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.