Logging
The Collaboration Server uses logging for different purposes. All log files are written to the logging output directory (see com.unblu.logging.outputDirectory). The main log file is a general purpose log file that is mostly used for status messages, warnings, errors and debug output (if enabled). The fatal log file only contains fatal errors (if any).
Log files
Unblu writes two log files. The sections below describe the purpose and contents of each of them.
Main log file
The main log file is a general purpose log file. All status messages, errors, warnings and debug messages are written to the main log file. By default the main log file is named unblu.<date>.log
.
Fatal log file
The fatal log is an extract of the general purpose log and only contains fatal errors. If anything is written to the fatal log, this means that the Collaboration Server will most probably not work correctly. By default the fatal log file is named unblu-fatal.<date>.log
.
Log file format
The main and the fatal log use the following format per default.
format: DATE (ISO_8601) [ THREAD NAME] [ CONTEXT INFO] LEVEL ( LOGGER_NAME:LINE) MESSAGE example: 2017-05-23T13:30:01.346Z [ main] [u: s: c: p: r:] INFO (RuntimeProductResolver.java:85) Hello
The CONTEXT INFO
section holds the following (optional) information:
-
User (
u: <userid>
) -
Session (
s: <sessionId>
) (Web Session identified by the x-unblu-session cookie). -
Page (
p: <pageId>
) (Page impression in a browser client) -
Request (
r: <requestId>
) (Typically a HTTP request)
All information in the CONTEXT INFO
section is optional and only available if the log output was generated in a context that has the corresponding information associated.
Configuration
The logging system can be configured using configuration settings; see Configuration.
Output directory
The most important configuration setting regarding logging is com.unblu.logging.outputDirectory. It specifies the file system directory log files are written to. If no output directory is configured, Unblu will write log messages to standard output.
We recommend always setting a logging output directory when installing the Collaboration Server.
Enabling and disabling the fatal log
The fatal log can be enabled and disabled using com.unblu.logging.fatalLogEnabled.
Log file retention time
You can use the following configuration settings to define how many days the log files should be kept:
-
com.unblu.logging.mainLogMaxHistory for the main log.
-
com.unblu.logging.fatalLogMaxHistory for the fatal log.
Logging database queries
There are configuration properties to define which database queries to log:
-
com.unblu.profiling.highRowCountThreshold: Typically, database queries should only retrieve a handful of entities. Even a search is unlikely to return more than say, 1000 entries. Queries that return a very large number of entities may point to a problem.
If a query returns more rows than the number specified in com.unblu.profiling.highRowCountThreshold, Unblu logs the query.
-
com.unblu.profiling.slowQueryThreshold: If a query takes longer to complete than the time, in milliseconds, specified in this configuration property, Unblu logs the query.
Log levels
Unblu logging supports different log levels (ERROR
, WARN
, INFO
, and DEBUG
). By default, the log level for Unblu is set to INFO
and the log level for integrated third-party libraries is set to WARN
.
The root level for Unblu can be changed using com.unblu.logging.rootLevel.
The root level for third-party libraries can be changed using configuration-properties
.
Log levels for individual loggers (packages or classes) can be set using the following notation:
com.unblu.logging.level.<loggerName>=<level>
If, for example, the log level is to be set to DEBUG
for the logger com.unblu.review.server.filter
, you must add the following configuration setting:
com.unblu.logging.level.com.unblu.review.server.filter=DEBUG
When analyzing issues in the Collaboration Server, it can be useful to trace HTTP requests. To do so, set com.unblu.logging.level.com.unblu.platform.server.core.internal.WrapperServlet
to the log level TRACE
.
If you’ve enabled WebSockets, you can also trace WebSocket requests by setting com.unblu.logging.level.com.unblu.runtime.server.websocket.jetty.GenericWebSocketCreator
to TRACE
.
You can change logging levels for the server only, the client only, or for shared code as required.
-
For both server and client:
com.unblu.logging.level.<loggerName>
-
For only the server:
com.unblu.server.logging.level.<loggerName>
-
For only the client:
com.unblu.client.logging.level.<loggerName>
For the client, only the log levels ERROR
, WARN
, and INFO
are available.
Advanced configuration
All logging-related configuration settings are listed in the com.unblu.platform.server.core.LoggingConfiguration section of the Configuration Properties reference.