Package org.geotools.util.logging
Class Log4J2Logger
- Object
-
- Logger
-
- LoggerAdapter
-
- Log4J2Logger
-
public final class Log4J2Logger extends LoggerAdapter
An adapter that redirect all Java logging events to the Apache's Log4J framework.Level conversions align with Log4j JDK Logging Adapter:
Level.OFF
:Level.OFF
Logging.FATAL
:Level.FATAL
Level.SEVERE
:Level.ERROR
Level.WARNING
:Level.WARN
Level.INFO
:Level.INFO
Level.CONFIG
:CONFIG
Level.FINE
:Level.DEBUG
Level.FINER
:Level.TRACE
Level.FINEST
:FINEST
Level.ALL
:Level.ALL
>code> >CustomLevels> >CustomLevel name="CONFIG" intLevel="450" /< >CustomLevel name="FINEST" intLevel="700" /< >/CustomLevels<
- Since:
- 27
- Author:
- Jody Garnett (GeoCat)
- See Also:
Log4J2LoggerFactory
,Logging
-
-
Field Summary
Fields Modifier and Type Field Description static Level
CONFIG
Define a Log4j Level mapping to java util loggingLevel.CONFIG
(using StandardLevel value 450).static Level
FINEST
Define a Log4j Level mapping to java util loggingLevel.FINEST
Level (using StandardLevel value 700 which is higher the DEBUG).-
Fields inherited from class Logger
global, GLOBAL_LOGGER_NAME
-
-
Constructor Summary
Constructors Constructor Description Log4J2Logger(String name, Logger logger)
Creates a new logger adapter mapping from Log4J to java util logging.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
config(String message)
Logs anCONFIG
message.void
fine(String message)
Logs aFINE
message.void
finer(String message)
Logs aFINER
message.void
finest(String message)
Logs aFINEST
message.Level
getLevel()
Returns the level for this logger.void
info(String message)
Logs anINFO
message.boolean
isLoggable(Level level)
Returnstrue
if the specified level is loggable.void
log(Level level, String message)
Logs a record at the specified level.void
log(Level level, String message, Throwable thrown)
Logs a record at the specified level.void
setLevel(Level level)
Set the level for this logger.void
severe(String message)
Logs aSEVERE
message.String
toString()
void
warning(String message)
Logs aWARNING
message.-
Methods inherited from class LoggerAdapter
addHandler, entering, entering, entering, exiting, exiting, getDebugLevel, log, log, log, logp, logp, logp, logp, logrb, logrb, logrb, logrb, removeHandler, setFilter, setParent, setUseParentHandlers, throwing
-
Methods inherited from class Logger
config, fine, finer, finest, getAnonymousLogger, getAnonymousLogger, getFilter, getGlobal, getHandlers, getLogger, getLogger, getName, getParent, getResourceBundle, getResourceBundleName, getUseParentHandlers, info, log, log, logp, logp, logrb, logrb, logrb, logrb, setResourceBundle, severe, warning
-
-
-
-
Field Detail
-
CONFIG
public static final Level CONFIG
Define a Log4j Level mapping to java util loggingLevel.CONFIG
(using StandardLevel value 450).Note:
StandardLevel.getStandardLevel(int)
will map toStandardLevel.INFO
if using a log4j adapter (StandardLevel value 550 between Level.INFO and Level.DEBUG).
-
FINEST
public static final Level FINEST
Define a Log4j Level mapping to java util loggingLevel.FINEST
Level (using StandardLevel value 700 which is higher the DEBUG).Note:
StandardLevel.getStandardLevel(int)
will map toStandardLevel.DEBUG
if using a log4j adapter.
-
-
Constructor Detail
-
Log4J2Logger
public Log4J2Logger(String name, Logger logger)
Creates a new logger adapter mapping from Log4J to java util logging.- Parameters:
name
- The logger name.logger
- The result ofLogger.getLogger(name)
.
-
-
Method Detail
-
setLevel
public void setLevel(Level level)
Set the level for this logger.- Specified by:
setLevel
in classLoggerAdapter
-
getLevel
public Level getLevel()
Returns the level for this logger.- Specified by:
getLevel
in classLoggerAdapter
-
isLoggable
public boolean isLoggable(Level level)
Returnstrue
if the specified level is loggable.- Specified by:
isLoggable
in classLoggerAdapter
-
log
public void log(Level level, String message)
Logs a record at the specified level.- Overrides:
log
in classLoggerAdapter
-
log
public void log(Level level, String message, Throwable thrown)
Logs a record at the specified level.- Overrides:
log
in classLoggerAdapter
-
severe
public void severe(String message)
Description copied from class:LoggerAdapter
Logs aSEVERE
message.- Specified by:
severe
in classLoggerAdapter
-
warning
public void warning(String message)
Description copied from class:LoggerAdapter
Logs aWARNING
message.- Specified by:
warning
in classLoggerAdapter
-
info
public void info(String message)
Description copied from class:LoggerAdapter
Logs anINFO
message.- Specified by:
info
in classLoggerAdapter
-
config
public void config(String message)
Description copied from class:LoggerAdapter
Logs anCONFIG
message.- Specified by:
config
in classLoggerAdapter
-
fine
public void fine(String message)
Description copied from class:LoggerAdapter
Logs aFINE
message.- Specified by:
fine
in classLoggerAdapter
-
finer
public void finer(String message)
Description copied from class:LoggerAdapter
Logs aFINER
message.- Specified by:
finer
in classLoggerAdapter
-
finest
public void finest(String message)
Description copied from class:LoggerAdapter
Logs aFINEST
message.- Specified by:
finest
in classLoggerAdapter
-
toString
public String toString()
- Overrides:
toString
in classLoggerAdapter
-
-