Package net.ssehub.easy.basics.logger
Class JavaLogger
java.lang.Object
net.ssehub.easy.basics.logger.AbstractJavaLogger
net.ssehub.easy.basics.logger.JavaLogger
- All Implemented Interfaces:
ILogger
This class is the ILogger implementation for java.util.logging.Logger.
- Author:
- Sass
-
Nested Class Summary
Nested classes/interfaces inherited from class net.ssehub.easy.basics.logger.AbstractJavaLogger
AbstractJavaLogger.ConsoleHandler -
Field Summary
FieldsFields inherited from class net.ssehub.easy.basics.logger.AbstractJavaLogger
DEBUG_LEVEL, DEFAULT_LEVEL, EXCEPTION_LEVEL, LOG_FORMATTER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidLog a DEBUG message.voidLog an ERROR message.voidLog an EXCEPTION message.voidLog an INFO message.voidEach Logger and each Handler can have a filter associated with it.voidLog a WARN message.Methods inherited from class net.ssehub.easy.basics.logger.AbstractJavaLogger
createLogger
-
Field Details
-
consoleHandler
-
logger
-
-
Constructor Details
-
JavaLogger
public JavaLogger()Constructor to initialize the instance of the logger. To change the output format modify theLogFormatterclass. By default the logging level is set to ALL. In a productive environment the level should be set to INFO. Use thesetLogLevelmethod to change the level.
-
-
Method Details
-
info
Description copied from interface:ILoggerLog an INFO message. If the logger is currently enabled for the INFO message level then the given message is forwarded to all the registered output Handler objects.- Parameters:
msg- The string message (or a key in the message catalog)clazz- The class where the message was createdbundleName- Name of the bundle where the message was created
-
error
Description copied from interface:ILoggerLog an ERROR message. If the logger is currently enabled for the ERROR message level then the given message is forwarded to all the registered output Handler objects.- Parameters:
msg- The string message (or a key in the message catalog)clazz- The class where the message was createdbundleName- Name of the bundle where the message was created
-
warn
Description copied from interface:ILoggerLog a WARN message. If the logger is currently enabled for the WARN message level then the given message is forwarded to all the registered output Handler objects.- Parameters:
msg- The string message (or a key in the message catalog)clazz- The class where the message was createdbundleName- Name of the bundle where the message was created
-
debug
Description copied from interface:ILoggerLog a DEBUG message. If the logger is currently enabled for the DEBUG message level then the given message is forwarded to all the registered output Handler objects.- Parameters:
msg- The string message (or a key in the message catalog)clazz- The class where the message was createdbundleName- Name of the bundle where the message was created
-
exception
Description copied from interface:ILoggerLog an EXCEPTION message. If the logger is currently enabled for the EXCEPTION message level then the given message is forwarded to all the registered output Handler objects.- Parameters:
msg- The string message (or a key in the message catalog)clazz- The class where the message was createdbundleName- Name of the bundle where the message was created
-
setFilter
Each Logger and each Handler can have a filter associated with it. The Logger or Handler will call the isLoggable method to check if a given LogRecord should be published. If isLoggable returns false, the LogRecord will be discarded. This method should only be used for jUnit testing since it suppresses logging.- Parameters:
filter- TheFilterthat should be used. May be null.
-