Class LogHelper
- java.lang.Object
-
- com.sun.jdo.spi.persistence.utility.logging.LogHelper
-
public class LogHelper extends Object
This class manages the logging facility for JDO components. It is the class that keeps track of the log factory in use for getting loggers for use in JDO components.This class has no JDK 1.4 dependencies.
The log factory is responsible for constructing the loggers and for ensuring that there is only one logger per component.
- Version:
- 1.0
- Author:
- Craig Russell
-
-
Field Summary
Fields Modifier and Type Field Description protected static boolean
jdk14
Flag to tell we are running in JDK 1.4 and can use java.util.logging.Logger implementation.protected static LoggerFactory
loggerFactory
LoggerFactory registered for creating new loggers.
-
Constructor Summary
Constructors Constructor Description LogHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Logger
getLogger(String loggerName, String bundleName, ClassLoader loader)
Get a Logger.static boolean
isJDK14()
Check to see if the JDK 1.4 logging environment is available.static void
registerLoggerFactory(LoggerFactory factory)
Register a LoggerFactory for use in managed environments or for special situations.
-
-
-
Field Detail
-
jdk14
protected static boolean jdk14
Flag to tell we are running in JDK 1.4 and can use java.util.logging.Logger implementation.
-
loggerFactory
protected static LoggerFactory loggerFactory
LoggerFactory registered for creating new loggers.
-
-
Method Detail
-
getLogger
public static Logger getLogger(String loggerName, String bundleName, ClassLoader loader)
Get a Logger. This call is delegated to the registered LoggerFactory. If there is no registered LoggerFactory, then initialize one based on whether we are running in JDK 1.4 (or higher). The bundle name and class loader are passed to allow the implementation to properly find and construct the internationalization bundle. This method is synchronized to avoid race conditions where two threads access a component using the same Logger at the same time.- Parameters:
loggerName
- the relative name of this loggerbundleName
- the fully qualified name of the resource bundleloader
- the class loader used to load the resource bundle, or null- Returns:
- the logger
-
registerLoggerFactory
public static void registerLoggerFactory(LoggerFactory factory)
Register a LoggerFactory for use in managed environments or for special situations. This factory will be delegated to for all getLogger requests.- Parameters:
factory
- the LoggerFactory to use for all getLogger requests
-
isJDK14
public static boolean isJDK14()
Check to see if the JDK 1.4 logging environment is available.- Returns:
- true if JDK 1.4 logging is available
-
-