Package net.ssehub.easy.basics.logger
Class FileLogger
java.lang.Object
net.ssehub.easy.basics.logger.AbstractJavaLogger
net.ssehub.easy.basics.logger.FileLogger
- All Implemented Interfaces:
ILogger
Simple logger for logging into a specified file.
- Author:
- El-Sharkawy
-
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
ConstructorsModifierConstructorDescriptionprivateFileLogger(String path, boolean append) Creates anILoggerfor logging into a specified file. -
Method Summary
Modifier and TypeMethodDescriptionvoidLog a DEBUG message.voidLog an ERROR message.voidLog an EXCEPTION message.static FileLoggergetInstance(String path, boolean append) Returns the singleton instance of thisILoggerimplementation.voidLog an INFO message.voidLog a WARN message.Methods inherited from class net.ssehub.easy.basics.logger.AbstractJavaLogger
createLogger
-
Field Details
-
instance
-
fileHandler
-
logger
-
-
Constructor Details
-
FileLogger
Creates anILoggerfor logging into a specified file.- Parameters:
path- The path of the file where the log file shall be written.append- Iftruelog data will be appended to existing files, otherwise existing files will be overwritten- Throws:
IOException- if there are IO problems opening the files.SecurityException- if a security manager exists and if the caller does not haveLoggingPermission("control").IllegalArgumentException- if pattern is an empty string
-
-
Method Details
-
getInstance
Returns the singleton instance of thisILoggerimplementation.- Parameters:
path- The path of the file where the log file shall be written.append- Iftruelog data will be appended to existing files, otherwise existing files will be overwritten- Returns:
- The first successfully created logger, or null if no logger could be created, e.g. if no valid path was specified.
-
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
-