Class LoggerJDK14
- java.lang.Object
-
- java.util.logging.Logger
-
- com.sun.jdo.spi.persistence.utility.logging.LoggerJDK14
-
-
Field Summary
Fields Modifier and Type Field Description protected String
sourceClassName
Class that issued logging call; set by inferCaller.protected String
sourceMethodName
Method that issued logging call; set by inferCaller.-
Fields inherited from class java.util.logging.Logger
global, GLOBAL_LOGGER_NAME
-
-
Constructor Summary
Constructors Constructor Description LoggerJDK14(String loggerName, String bundleName)
Creates new LoggerJDK14.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Level
convertLevel(int level)
Convert an int level used by jdo logger to the Level instance used by JDK 1.4 logger.void
fine(String msg, Object o1)
Log a FINE message.void
fine(String msg, Object[] o)
Log a FINE message.void
fine(String msg, Object o1, Object o2)
Log a FINE message.void
fine(String msg, Object o1, Object o2, Object o3)
Log a FINE message.void
finer(String msg, Object o1)
Log a FINER message.void
finer(String msg, Object[] o)
Log a FINER message.void
finer(String msg, Object o1, Object o2)
Log a FINER message.void
finer(String msg, Object o1, Object o2, Object o3)
Log a FINER message.void
finest(String msg, Object o1)
Log a FINEST message.void
finest(String msg, Object[] o)
Log a FINEST message.void
finest(String msg, Object o1, Object o2)
Log a FINEST message.void
finest(String msg, Object o1, Object o2, Object o3)
Log a FINEST message.protected void
inferCaller()
Method to infer the caller's class name and method name.boolean
isLoggable()
Return whether logging is enabled at the FINE level.boolean
isLoggable(int levelValue)
Check if a message of the given level would actually be logged by this logger.protected boolean
isLoggerClass(String className)
This method is a helper method forinferCaller()
.void
log(int level, String msg)
Log a message.void
log(int level, String msg, Object o1)
Log a message.void
log(int level, String msg, Object[] o)
Log a message.void
log(int level, String msg, Object o1, Object o2)
Log a message.void
log(int level, String msg, Object o1, Object o2, Object o3)
Log a message.void
log(int level, String msg, Throwable thrown)
Log a message.String
toString()
Prepare a printable version of this instance.-
Methods inherited from class java.util.logging.Logger
addHandler, config, config, entering, entering, entering, exiting, exiting, fine, fine, finer, finer, finest, finest, getAnonymousLogger, getAnonymousLogger, getFilter, getGlobal, getHandlers, getLevel, getLogger, getLogger, getName, getParent, getResourceBundle, getResourceBundleName, getUseParentHandlers, info, info, isLoggable, log, log, log, log, log, log, log, logp, logp, logp, logp, logp, logp, logrb, logrb, logrb, logrb, logrb, logrb, logrb, logrb, removeHandler, setFilter, setLevel, setParent, setResourceBundle, setUseParentHandlers, severe, severe, throwing, warning, warning
-
-
-
-
Constructor Detail
-
LoggerJDK14
public LoggerJDK14(String loggerName, String bundleName)
Creates new LoggerJDK14. The Thread context class loader or the loader which loaded this class must be able to load the bundle.- Parameters:
loggerName
- the full domain name of this loggerbundleName
- the bundle name for message translation
-
-
Method Detail
-
isLoggable
public boolean isLoggable()
Return whether logging is enabled at the FINE level. This method is not exact because to make it accurately reflect the logging level we would have to include the JDK 1.4 java.util.logging.Level class.- Specified by:
isLoggable
in interfaceLogger
- Returns:
- whether logging is enabled at the fine level.
-
fine
public void fine(String msg, Object[] o)
Log a FINE message.If the logger is currently enabled for the FINE message level then the given message is forwarded to all the registered output Handler objects.
-
fine
public void fine(String msg, Object o1)
Log a FINE message.If the logger is currently enabled for the FINE message level then the given message is forwarded to all the registered output Handler objects.
-
fine
public void fine(String msg, Object o1, Object o2)
Log a FINE message.If the logger is currently enabled for the FINE message level then the given message is forwarded to all the registered output Handler objects.
-
fine
public void fine(String msg, Object o1, Object o2, Object o3)
Log a FINE message.If the logger is currently enabled for the FINE message level then the given message is forwarded to all the registered output Handler objects.
-
finer
public void finer(String msg, Object[] o)
Log a FINER message.If the logger is currently enabled for the FINER message level then the given message is forwarded to all the registered output Handler objects.
-
finer
public void finer(String msg, Object o1)
Log a FINER message.If the logger is currently enabled for the FINER message level then the given message is forwarded to all the registered output Handler objects.
-
finer
public void finer(String msg, Object o1, Object o2)
Log a FINER message.If the logger is currently enabled for the FINER message level then the given message is forwarded to all the registered output Handler objects.
-
finer
public void finer(String msg, Object o1, Object o2, Object o3)
Log a FINER message.If the logger is currently enabled for the FINER message level then the given message is forwarded to all the registered output Handler objects.
-
finest
public void finest(String msg, Object[] o)
Log a FINEST message.If the logger is currently enabled for the FINEST message level then the given message is forwarded to all the registered output Handler objects.
-
finest
public void finest(String msg, Object o1)
Log a FINEST message.If the logger is currently enabled for the FINEST message level then the given message is forwarded to all the registered output Handler objects.
-
finest
public void finest(String msg, Object o1, Object o2)
Log a FINEST message.If the logger is currently enabled for the FINEST message level then the given message is forwarded to all the registered output Handler objects.
-
finest
public void finest(String msg, Object o1, Object o2, Object o3)
Log a FINEST message.If the logger is currently enabled for the FINEST message level then the given message is forwarded to all the registered output Handler objects.
-
toString
public String toString()
Prepare a printable version of this instance.
-
log
public void log(int level, String msg, Object o1)
Log a message.If the logger is currently enabled for the message level then the given message is forwarded to all the registered output Handler objects.
-
log
public void log(int level, String msg, Object o1, Object o2)
Log a message.If the logger is currently enabled for the message level then the given message is forwarded to all the registered output Handler objects.
-
log
public void log(int level, String msg, Object o1, Object o2, Object o3)
Log a message.If the logger is currently enabled for the message level then the given message is forwarded to all the registered output Handler objects.
-
log
public void log(int level, String msg, Object[] o)
Log a message.If the logger is currently enabled for the message level then the given message is forwarded to all the registered output Handler objects.
-
log
public void log(int level, String msg)
Log a message.If the logger is currently enabled for the message level then the given message is forwarded to all the registered output Handler objects.
-
log
public void log(int level, String msg, Throwable thrown)
Log a message.If the logger is currently enabled for the message level then the given message, and the exception dump, is forwarded to all the registered output Handler objects.
-
isLoggable
public boolean isLoggable(int levelValue)
Check if a message of the given level would actually be logged by this logger. This check is based on the Loggers effective level, which may be inherited from its parent.- Specified by:
isLoggable
in interfaceLogger
- Parameters:
levelValue
- the level to check- Returns:
- true if the given message level is currently being logged.
-
convertLevel
protected Level convertLevel(int level)
Convert an int level used by jdo logger to the Level instance used by JDK 1.4 logger. This is done to allow components to use logging outside the JDK 1.4 environment.- Parameters:
level
- the level to convert- Returns:
- the Level instance corresponding to the int level
-
inferCaller
protected void inferCaller()
Method to infer the caller's class name and method name. The method analyses the current stack trace, to find the method that issued the logger call. It stores the callers class and method name into fields sourceClassName and sourceMethodName.
-
isLoggerClass
protected boolean isLoggerClass(String className)
This method is a helper method forinferCaller()
. It returnstrue
if the specified class name denotes a logger class that should be ignored when analysing the stack trace to infer the caller of a log message.- Parameters:
className
- the class name to be checked.- Returns:
true
if the specified name denotes a logger class;false
otherwise.
-
-