org.deduced.utilities
Class LogUtilities

java.lang.Object
  extended by org.deduced.utilities.LogUtilities

public class LogUtilities
extends java.lang.Object

Log Utilities

Author:
Steve McDuff

Field Summary
private static boolean INITIALIZED
          Has the logger been initialized.
static java.lang.String JAVA_UTIL_LOGGING_CONFIG_CLASS
          property hosting the configuration file
static java.lang.String JAVA_UTIL_LOGGING_CONFIG_FILE
          property hosting the configuration file
private static java.util.logging.Logger LOGGER
          logger
 
Constructor Summary
LogUtilities()
           
 
Method Summary
static boolean isLoggerConfigurationInitialized()
          test if the logger configuration is initialized or not.
static boolean isLoggerConfiguredInSystemProperties()
          is Logger Configured In System Properties
static boolean isLoggerInitializedInProperties(java.util.Properties properties)
          is Logger Configured In the specified Properties
static void readLoggerConfiguration(boolean useSystemPropertyFirst, java.lang.String[] configurationFilesInPreferenceOrder)
          read the Logger Configuration.
static boolean readLoggerConfigurationFromFile(java.lang.String configurationFileName)
          read Logger Configuration From File.
static boolean readLoggerConfigurationFromFilesInPreferenceOrder(java.lang.String[] configurationFilesInPreferenceOrder)
          read Logger Configuration From Files In Preference Order.
static void readLoggerConfigurationOnce(boolean useSystemPropertyFirst, java.lang.String[] configurationFilesInPreferenceOrder)
          Read the Logger Configuration only once.
static void setLoggerConfigurationInitialized(boolean initialized)
          set Logger Configuration Initialized
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

private static final java.util.logging.Logger LOGGER
logger


JAVA_UTIL_LOGGING_CONFIG_FILE

public static final java.lang.String JAVA_UTIL_LOGGING_CONFIG_FILE
property hosting the configuration file

See Also:
Constant Field Values

JAVA_UTIL_LOGGING_CONFIG_CLASS

public static final java.lang.String JAVA_UTIL_LOGGING_CONFIG_CLASS
property hosting the configuration file

See Also:
Constant Field Values

INITIALIZED

private static boolean INITIALIZED
Has the logger been initialized. This flag is used to monitor if the log manager has been initialized or not. It is used by some methods who want to ensure that the log manager is initialized only once.

Constructor Detail

LogUtilities

public LogUtilities()
Method Detail

isLoggerConfigurationInitialized

public static boolean isLoggerConfigurationInitialized()
test if the logger configuration is initialized or not.

Returns:
the initialization status.
See Also:
INITIALIZED

setLoggerConfigurationInitialized

public static void setLoggerConfigurationInitialized(boolean initialized)
set Logger Configuration Initialized

Parameters:
initialized - the new initialized flag value
See Also:
INITIALIZED

readLoggerConfigurationOnce

public static void readLoggerConfigurationOnce(boolean useSystemPropertyFirst,
                                               java.lang.String[] configurationFilesInPreferenceOrder)
Read the Logger Configuration only once. Unlike readLoggerConfiguration(boolean, String[]), this method will insure that the logger is only initialized once during the application life cycle. This allows the application to call this method multiple times in a safe way.

Parameters:
useSystemPropertyFirst - See readLoggerConfiguration(boolean, String[])
configurationFilesInPreferenceOrder - See readLoggerConfiguration(boolean, String[])
See Also:
readLoggerConfiguration(boolean, String[])

readLoggerConfiguration

public static void readLoggerConfiguration(boolean useSystemPropertyFirst,
                                           java.lang.String[] configurationFilesInPreferenceOrder)
read the Logger Configuration. This method will always override the current logger configuration based on the parameters specified. Once this method is called, the log system is considered to be initialized.

Parameters:
useSystemPropertyFirst - if this option is set to true, the algorithm will look for the system properties to see if a logger configuration is already specified. If it is, this method will let the system use this configuration. Otherwise, this method will override the configuration in the system properties with the one specified in the preferred file list.
configurationFilesInPreferenceOrder - the list of files to read in order of preference. Those files may be located either on the local file system or as system resources.

readLoggerConfigurationFromFilesInPreferenceOrder

public static boolean readLoggerConfigurationFromFilesInPreferenceOrder(java.lang.String[] configurationFilesInPreferenceOrder)
read Logger Configuration From Files In Preference Order. If the operation is successful, the log manager will be considered initialized. See : INITIALIZED.

Parameters:
configurationFilesInPreferenceOrder - the list of files to attempt to load to configure the logger.
Returns:
true if the logger was successfully configured. False otherwise

readLoggerConfigurationFromFile

public static boolean readLoggerConfigurationFromFile(java.lang.String configurationFileName)
read Logger Configuration From File. If the operation is successful, the log manager will be considered initialized. See : INITIALIZED.

Parameters:
configurationFileName - the configuration file name to use
Returns:
true if the logger was successfully configured using the specified file

isLoggerConfiguredInSystemProperties

public static boolean isLoggerConfiguredInSystemProperties()
is Logger Configured In System Properties

Returns:
true if the system contains properties to initialize the logger. False otherwise.

isLoggerInitializedInProperties

public static boolean isLoggerInitializedInProperties(java.util.Properties properties)
is Logger Configured In the specified Properties

Parameters:
properties - the properties to use
Returns:
true if the properties contains values used to initialize the logger. False otherwise.