Package org.apache.poi.util
Class POILogger
java.lang.Object
org.apache.poi.util.POILogger
- Direct Known Subclasses:
CommonsLogger
,NullLogger
,SystemOutLogger
A logger interface that strives to make it as easy as possible for
developers to write log calls, while simultaneously making those
calls as cheap as possible by performing lazy evaluation of the log
message.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
Log a messageprotected abstract void
Log a messageabstract boolean
check
(int level) Check if a logger is enabled to log at the specified level This allows code to avoid building strings or evaluating functions in the arguments to log.abstract void
initialize
(String cat) void
Log a message.
-
Field Details
-
DEBUG
public static final int DEBUG- See Also:
-
INFO
public static final int INFO- See Also:
-
WARN
public static final int WARN- See Also:
-
ERROR
public static final int ERROR- See Also:
-
FATAL
public static final int FATAL- See Also:
-
LEVEL_STRINGS_SHORT
Short strings for numeric log level. Use level as array index. -
LEVEL_STRINGS
Long strings for numeric log level. Use level as array index.
-
-
Method Details
-
initialize
-
_log
Log a message- Parameters:
level
- One of DEBUG, INFO, WARN, ERROR, FATALobj1
- The object to log. This is converted to a string.
-
_log
Log a message- Parameters:
level
- One of DEBUG, INFO, WARN, ERROR, FATALobj1
- The object to log. This is converted to a string.exception
- An exception to be logged
-
check
public abstract boolean check(int level) Check if a logger is enabled to log at the specified level This allows code to avoid building strings or evaluating functions in the arguments to log. An example:if (logger.check(POILogger.INFO)) { logger.log(POILogger.INFO, "Avoid concatenating " + " strings and evaluating " + functions()); }
- Parameters:
level
- One of DEBUG, INFO, WARN, ERROR, FATAL
-
log
Log a message. Lazily appends Object parameters together. If the last parameter is aThrowable
it is logged specially.- Parameters:
level
- One of DEBUG, INFO, WARN, ERROR, FATALobjs
- the objects to place in the message
-