@Deprecated
public final class LoggerImpl
extends java.lang.Object
LogProvider
!
Helper framework for Java logger instances. Implements getter functions for
fetching a logger instance depending on the specified class. A normal user
will mostly call the getLogger(Class)
method to retrieve a logger
instance.
If the log is also written to a file by defining the method argument of
isStorable
then all logging is persistently stored on the mounted
drive. The drive depends on the OS:
Per default a flag for the MSTApp logger is set to false
and can be specified by
calling one of both methods #getLogger(Class, Level, boolean)
and
#getLogger(Class, Level, boolean, boolean, boolean)
NOTE: Never use the method #setLogFilename(String)
! The file name is filter from the
concrete package and main class name instance from its first call to getLogger(Class)
.
So you should always create one logger in the main class to clarify
the file name. If you do create a logger at a later stage in some
other class or in a sub-package the file name will change to the concrete
first calling class instance. This can result in unexpected file names. The
log file tries to find the corresponding log directory on windows drive L. If
it doesn't exist it will create one. In this directory the project name for
the class package name is filter to a directory name.
Modifier and Type | Class and Description |
---|---|
static class |
LoggerImpl.ELoggingProperty
Deprecated.
|
Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_TIME_AND_DATE
Deprecated.
|
static java.lang.String |
LOG_DIRECTORY
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
static java.util.logging.Logger |
createLogger(java.lang.Class<?> clazz)
Deprecated.
Use
getLogger(Class) instead. |
static java.util.logging.Logger |
createLogger(java.lang.Class<?> clazz,
boolean isStorable)
Deprecated.
Use method
@getLogger(Class, boolean) instead. |
static java.util.logging.Logger |
createLogger(java.lang.Class<?> clazz,
java.util.logging.Level level)
Deprecated.
Use
getLogger(Class, Level) instead. |
static java.util.logging.Logger |
createLogger(java.lang.Class<?> clazz,
java.util.logging.Level level,
boolean isStorable,
boolean hasDateFormat)
Deprecated.
Use
#getLogger(Class, Level, boolean, boolean) instead. |
static java.util.logging.Logger |
getLogger(java.lang.Class<?> clazz)
Deprecated.
|
static java.util.logging.Logger |
getLogger(java.lang.Class<?> clazz,
java.util.logging.Level level)
Deprecated.
|
static java.util.logging.Logger |
getLogger(java.lang.Class<?> clazz,
java.util.logging.Level level,
LoggerImpl.ELoggingProperty property)
Deprecated.
|
static java.util.logging.Logger |
getLogger(java.lang.Class<?> clazz,
java.util.logging.Level level,
LoggerImpl.ELoggingProperty property,
boolean hasDateFormat)
Deprecated.
|
static java.util.logging.Logger |
getLogger(java.lang.Class<?> clazz,
LoggerImpl.ELoggingProperty property)
Deprecated.
|
@Deprecated public static final boolean DEFAULT_TIME_AND_DATE
@Deprecated public static final java.lang.String LOG_DIRECTORY
@Deprecated public static java.util.logging.Logger createLogger(java.lang.Class<?> clazz)
getLogger(Class)
instead.getLogger(Class, Level)
.
The default log level is set to Level.INFO
. The logging is stored
in a file.clazz
- Logging class instance.@Deprecated public static java.util.logging.Logger getLogger(java.lang.Class<?> clazz)
getLogger(Class, Level)
.
The default log level is set to Level.INFO
. The logging is stored
in a file.clazz
- Logging class instance.@Deprecated public static java.util.logging.Logger createLogger(java.lang.Class<?> clazz, java.util.logging.Level level)
getLogger(Class, Level)
instead.#getLogger(Class, Level, boolean, boolean)
.
The default log level is set to Level.INFO
. The logging is stored
in a file.clazz
- Logging class instance.level
- Log level.@Deprecated public static java.util.logging.Logger getLogger(java.lang.Class<?> clazz, java.util.logging.Level level)
#getLogger(Class, Level, boolean, boolean)
.
The default log level is set to Level.INFO
. The logging is stored
in a file and only a timestamp is printed.clazz
- Logging class instance.level
- Log level.@Deprecated public static java.util.logging.Logger getLogger(java.lang.Class<?> clazz, java.util.logging.Level level, LoggerImpl.ELoggingProperty property)
#getLogger(Class, Level, boolean, boolean)
.
The default log level is set to Level.INFO
. The logging is stored
in a file and only a timestamp is printed.clazz
- Logging class instance.level
- Log level.allowsMCSLogging
- Specifies if beside the normal console logger also
the MSTApp logger is used.@Deprecated public static java.util.logging.Logger createLogger(java.lang.Class<?> clazz, boolean isStorable)
@getLogger(Class, boolean)
instead.#setLogFilename(String)
. For ore information you should
have a look at #getLogger(Class, Level, boolean, boolean)
.
The default log level is set to Level.INFO
and only a timestamp
is printed.clazz
- Logging class instance.isStorable
- Reflects if the logging information is stored in a
separate file. The files are rotated. You can specify the log
filename with the method #setLogFilename(String)
.
As a suffix of the filename a number from 1 to 10 represents older
log filenames.
The size of a file is 1000000 bytes.@Deprecated public static java.util.logging.Logger getLogger(java.lang.Class<?> clazz, LoggerImpl.ELoggingProperty property)
#setLogFilename(String)
. For more information you should
have a look at #getLogger(Class, Level, boolean, boolean)
.
The default log level is set to Level.INFO
and only a timestamp
is printed.clazz
- Logging class instance.isStorable
- Reflects if the logging information is stored in a
separate file. The files are rotated. You can specify the log
filename with the method #setLogFilename(String)
.
As a suffix of the filename a number from 1 to 10 represents older
log filenames.
The size of a file is 1000000 bytes.@Deprecated public static java.util.logging.Logger createLogger(java.lang.Class<?> clazz, java.util.logging.Level level, boolean isStorable, boolean hasDateFormat)
#getLogger(Class, Level, boolean, boolean)
instead.public class A { private static final Logger log = LoggerImpl.getLogger(A.class); ... void abc() { log.info("only a comment..."); } }You can influence the behavior of the logger with a property file. This file must contain valid key-value-pairs for controlling the behavior of the logger. For more information about the file see at Wikibooks (DE) web page. One example property file is included in the root folder
examples
under log/mpsdiag.properties
.
This can easily be set via the command line argument of
-Djava.util.logging.config.file=
/path/to/app.properties.
Moreover you can also specify the log filename with the method #setLogFilename(String)
.
clazz
- Logging class instance.level
- Log level.isStorable
- Reflects if the logging information is stored in a
separate file. The files are rotated. You can specify the log
filename with the method #setLogFilename(String)
.
As a suffix of the filename a number from 1 to 10 represents older
log filenames.
The size of a file is 1000000 bytes.hasDateFormat
- Specifies if the logging message only includes the
time (false) or time with date (true).@Deprecated public static java.util.logging.Logger getLogger(java.lang.Class<?> clazz, java.util.logging.Level level, LoggerImpl.ELoggingProperty property, boolean hasDateFormat)
public class A { private static final Logger log = LoggerImpl.getLogger(A.class); ... void abc() { log.info("only a comment..."); } }You can influence the behavior of the logger with a property file. This file must contain valid key-value-pairs for controlling the behavior of the logger. For more information about the file see at Wikibooks (DE) web page. One example property file is included in the root folder
examples
under log/mpsdiag.properties
.
This can easily be set via the command line argument of
-Djava.util.logging.config.file=
/path/to/app.properties.
Moreover you can also specify the log filename with the method #setLogFilename(String)
.
clazz
- Logging class instance.level
- Log level.property
- Specifies the logging property used for the returned instance.hasDateFormat
- Specifies if the logging message only includes the
time (false) or time with date (true).14-September-2016 18:23 Deutsches Elektronen-Synchrotron DESY in der Helmholtz-Gemeinschaft