public class FileLogger extends AbstractJavaLogger
AbstractJavaLogger.ConsoleHandler| Modifier and Type | Field and Description |
|---|---|
private java.util.logging.Handler |
fileHandler |
private static FileLogger |
instance |
private java.util.logging.Logger |
logger |
DEBUG_LEVEL, DEFAULT_LEVEL, EXCEPTION_LEVEL, LOG_FORMATTER| Modifier | Constructor and Description |
|---|---|
private |
FileLogger(java.lang.String path,
boolean append)
Creates an
ILogger for logging into a specified file. |
| Modifier and Type | Method and Description |
|---|---|
void |
debug(java.lang.String msg,
java.lang.Class<?> clazz,
java.lang.String bundleName)
Log an DEBUG message.
|
void |
error(java.lang.String msg,
java.lang.Class<?> clazz,
java.lang.String bundleName)
Log an ERROR message.
|
void |
exception(java.lang.String msg,
java.lang.Class<?> clazz,
java.lang.String bundleName)
Log an EXCEPTION message.
|
static FileLogger |
getInstance(java.lang.String path,
boolean append)
Returns the singleton instance of this
ILogger implementation. |
void |
info(java.lang.String msg,
java.lang.Class<?> clazz,
java.lang.String bundleName)
Log an INFO message.
|
void |
warn(java.lang.String msg,
java.lang.Class<?> clazz,
java.lang.String bundleName)
Log an WARN message.
|
createLoggerprivate static FileLogger instance
private java.util.logging.Handler fileHandler
private java.util.logging.Logger logger
private FileLogger(java.lang.String path,
boolean append)
throws java.lang.SecurityException,
java.io.IOException
ILogger for logging into a specified file.path - The path of the file where the log file shall be written.append - If true log data will be appended to existing files,
otherwise existing files will be overwrittenjava.io.IOException - if there are IO problems opening the files.java.lang.SecurityException - if a security manager exists and if
the caller does not have LoggingPermission("control").java.lang.IllegalArgumentException - if pattern is an empty stringpublic static FileLogger getInstance(java.lang.String path, boolean append)
ILogger implementation.path - The path of the file where the log file shall be written.append - If true log data will be appended to existing files,
otherwise existing files will be overwrittenpublic void info(java.lang.String msg,
java.lang.Class<?> clazz,
java.lang.String bundleName)
ILoggerIf the logger is currently enabled for the INFO message level then the given message is forwarded to all the registered output Handler objects.
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 createdpublic void error(java.lang.String msg,
java.lang.Class<?> clazz,
java.lang.String bundleName)
ILoggerIf the logger is currently enabled for the ERROR message level then the given message is forwarded to all the registered output Handler objects.
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 createdpublic void warn(java.lang.String msg,
java.lang.Class<?> clazz,
java.lang.String bundleName)
ILoggerIf the logger is currently enabled for the WARN message level then the given message is forwarded to all the registered output Handler objects.
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 createdpublic void debug(java.lang.String msg,
java.lang.Class<?> clazz,
java.lang.String bundleName)
ILoggerIf the logger is currently enabled for the DEBUG message level then the given message is forwarded to all the registered output Handler objects.
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 createdpublic void exception(java.lang.String msg,
java.lang.Class<?> clazz,
java.lang.String bundleName)
ILoggerIf the logger is currently enabled for the EXCEPTION message level then the given message is forwarded to all the registered output Handler objects.
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 createdCopyright © 2009 - 2018 SSE. All Rights Reserved.