Package org.europa.together.application
Class LogbackLogger
- java.lang.Object
-
- org.europa.together.application.LogbackLogger
-
- All Implemented Interfaces:
Logger
@FeatureToggle(featureID="CM-0001") public class LogbackLogger extends Object implements Logger
Implementation of the Logger as Wrapper for SLF4j and logback Framework.
-
-
Field Summary
-
Fields inherited from interface org.europa.together.business.Logger
CONFIG_SET, CONFIG_VERSION, FEATURE_ID, SYSTEM_APP_DIR
-
-
Constructor Summary
Constructors Constructor Description LogbackLogger(Class<?> instance)
Create an instance of the logging class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
catchException(Exception ex)
Modified Method to log Exceptions.LogLevel
getConfiguredLogLevel()
Get the configured LogLevel for the Logger.LogLevel
log(String message, LogLevel level)
Create a Log-Entry with the given message for the configured Log-Level.void
setLogLevel(LogLevel level)
Set the LogLevel programmatically.
-
-
-
Constructor Detail
-
LogbackLogger
public LogbackLogger(Class<?> instance)
Create an instance of the logging class. THe configuration file will be searched in the Directory, where the application is running.- Parameters:
instance
- The instance of the logged CLASS- See Also:
/logback.xml If is no configuration present at this position, the logger use the default configuration in the classpath, with the console appender.
-
-
Method Detail
-
log
public LogLevel log(String message, LogLevel level)
Description copied from interface:Logger
Create a Log-Entry with the given message for the configured Log-Level. Log-Level: TRACE | DEBUG | INFO | WARN | ERROR
-
getConfiguredLogLevel
public LogLevel getConfiguredLogLevel()
Description copied from interface:Logger
Get the configured LogLevel for the Logger.- Specified by:
getConfiguredLogLevel
in interfaceLogger
- Returns:
- LogLevel
-
catchException
public String catchException(Exception ex)
Description copied from interface:Logger
Modified Method to log Exceptions. The output will be the exception Name and the exception message in the LogLevel Error. In the case a NullPointerException is thrown, the StackTrace will be logged too.- Specified by:
catchException
in interfaceLogger
- Parameters:
ex
- as Exception- Returns:
- exception Message as String
-
setLogLevel
public void setLogLevel(LogLevel level)
Description copied from interface:Logger
Set the LogLevel programmatically. Log-Level: TRACE | DEBUG | INFO | WARN | ERROR- Specified by:
setLogLevel
in interfaceLogger
- Parameters:
level
- as LogLevel
-
-