Package com.axelor.common.logging
Class LoggerConfiguration
java.lang.Object
com.axelor.common.logging.LoggerConfiguration
The logger configuration builder using logback-classic.
If logging.config is given, all other properties will be ignored.
If logging.path is not given, file appender will be disabled
If logging.pattern.file is set to
If logging.pattern.console is set to
If logback.xml is found in classpath and
It can be configured with following properties:
- logging.config - the path to custom logback config file
- logging.path - the directory where log files are saved
- logging.pattern.file - the logging pattern for file appender
- logging.pattern.console - the logging pattern for console appender
- logging.level.root - the logging level of root logger
- logging.level.com.axelor - the logging level of given logger
If logging.config is given, all other properties will be ignored.
If logging.path is not given, file appender will be disabled
If logging.pattern.file is set to
OFF, file appender will be disabledIf logging.pattern.console is set to
OFF, console appender will be disabled
If logback.xml is found in classpath and
skipDefaultConfig is false, no
custom configuration is done.
The logging pattern can use %clr() to highlight based on log level, or
%clr(){color} with faint, red, green, yellow, blue, magenta, cyan as color to
style the log message on console output.
The logging pattern can use %tenant to output the current tenant identifier, or
%tenant{-} to output - when no tenant is set on the thread. When
multi-tenancy is enabled, the ${LOG_TENANT_PATTERN} variable is set to
[%tenant{-}] , which is included in the default patterns before the thread name. The raw
tenant identifier is also available with %X{tenant}.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe MDC key holding the current tenant identifier. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconversionRule(String word, Class<? extends ch.qos.logback.core.pattern.Converter<?>> converter) voidinstall()voidmultiTenancy(boolean multiTenancy) Whether multi-tenancy is enabled.voidskipDefaultConfig(boolean skipDefaultConfig) void
-
Field Details
-
TENANT_MDC_KEY
The MDC key holding the current tenant identifier.- See Also:
-
-
Constructor Details
-
LoggerConfiguration
-
-
Method Details
-
skipDefaultConfig
public void skipDefaultConfig(boolean skipDefaultConfig) -
multiTenancy
public void multiTenancy(boolean multiTenancy) Whether multi-tenancy is enabled. If so, the default patterns include the tenant.- Parameters:
multiTenancy- true if multi-tenancy is enabled
-
install
public void install() -
uninstall
public void uninstall() -
conversionRule
-