Class Logging
java.lang.Object
cl.netswitch.lib.util.Logging
Provides static utility methods used to configure the System Logging Facility.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidstatic voidchangeDefaultFormatters(Formatter formatter) static voidchangeDefaultFormatters(Formatter formatter, boolean alwaysChange) static booleaninitialize(File configFile) Initialize the logging facility using supplied configuration file.
-
Method Details
-
initialize
Initialize the logging facility using supplied configuration file. If the system properties"java.util.logging.config.class"and"java.util.logging.config.file"are not defined, the logging facility isreinitializedreading the configuration file, if it exists.- Parameters:
configFile- the configuration property file.- Returns:
trueif the configuration file was loaded.- Throws:
NullPointerException- ifconfigFileisnull.SecurityException- if a security error occurs.IOException- if an I/O error occurs.
-
changeDefaultFormatters
Changes the formatters ofConsoleHandlerandFileHandlerhandlers by aLogFormatter.A
ConsoleHandleris changed only if it's current formatter is aSimpleFormatter.A
FileHandleris changed only if it's current formatter is anXMLFormatter.- Throws:
SecurityException- if the formatter could not be changed.
-
changeDefaultFormatters
Changes the formatters ofConsoleHandlerandFileHandlerhandlers by suppliedformatter.A
ConsoleHandleris changed only if it's current formatter is aSimpleFormatter.A
FileHandleris changed only if it's current formatter is anXMLFormatter.- Parameters:
formatter- the logging formatter to be assign to standard handlers.- Throws:
NullPointerException- ifformatterisnull.SecurityException- if the formatter could not be changed.
-
changeDefaultFormatters
public static void changeDefaultFormatters(Formatter formatter, boolean alwaysChange) throws SecurityException Changes the formatters ofConsoleHandlerandFileHandlerhandlers by the suppliedformatter.A
ConsoleHandleris changed if it's current formatter is aSimpleFormatteror ifalwaysChangeistrue.A
FileHandleris changed if it's current formatter is anXMLFormatteror ifalwaysChangeistrue.- Parameters:
formatter- the logging formatter to be assign to standard handlers.alwaysChange- iftruestandard handlers are always changed.- Throws:
NullPointerException- ifformatterisnull.SecurityException- if the formatter could not be changed.
-