Class LogHelper
java.lang.Object
com.sun.jdo.spi.persistence.utility.logging.LogHelper
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
FieldsModifier and TypeFieldDescriptionprotected static booleanFlag to tell we are running in JDK 1.4 and can use java.util.logging.Logger implementation.protected static LoggerFactoryLoggerFactory registered for creating new loggers. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic LoggergetLogger(String loggerName, String bundleName, ClassLoader loader) Get a Logger.static booleanisJDK14()Check to see if the JDK 1.4 logging environment is available.static voidregisterLoggerFactory(LoggerFactory factory) Register a LoggerFactory for use in managed environments or for special situations.
-
Field Details
-
jdk14
protected static boolean jdk14Flag to tell we are running in JDK 1.4 and can use java.util.logging.Logger implementation. -
loggerFactory
LoggerFactory registered for creating new loggers.
-
-
Constructor Details
-
LogHelper
public LogHelper()
-
-
Method Details
-
getLogger
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
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
-