java.lang.Object
cl.netswitch.lib.util.Logging
Provides static utility methods used to configure the System Logging Facility.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
static void
changeDefaultFormatters
(Formatter formatter) static void
changeDefaultFormatters
(Formatter formatter, boolean alwaysChange) static boolean
initialize
(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 isreinitialized
reading the configuration file, if it exists.- Parameters:
configFile
- the configuration property file.- Returns:
true
if the configuration file was loaded.- Throws:
NullPointerException
- ifconfigFile
isnull
.SecurityException
- if a security error occurs.IOException
- if an I/O error occurs.
-
changeDefaultFormatters
Changes the formatters ofConsoleHandler
andFileHandler
handlers by aLogFormatter
.A
ConsoleHandler
is changed only if it's current formatter is aSimpleFormatter
.A
FileHandler
is changed only if it's current formatter is anXMLFormatter
.- Throws:
SecurityException
- if the formatter could not be changed.
-
changeDefaultFormatters
Changes the formatters ofConsoleHandler
andFileHandler
handlers by suppliedformatter
.A
ConsoleHandler
is changed only if it's current formatter is aSimpleFormatter
.A
FileHandler
is changed only if it's current formatter is anXMLFormatter
.- Parameters:
formatter
- the logging formatter to be assign to standard handlers.- Throws:
NullPointerException
- ifformatter
isnull
.SecurityException
- if the formatter could not be changed.
-
changeDefaultFormatters
public static void changeDefaultFormatters(Formatter formatter, boolean alwaysChange) throws SecurityException Changes the formatters ofConsoleHandler
andFileHandler
handlers by the suppliedformatter
.A
ConsoleHandler
is changed if it's current formatter is aSimpleFormatter
or ifalwaysChange
istrue
.A
FileHandler
is changed if it's current formatter is anXMLFormatter
or ifalwaysChange
istrue
.- Parameters:
formatter
- the logging formatter to be assign to standard handlers.alwaysChange
- iftrue
standard handlers are always changed.- Throws:
NullPointerException
- ifformatter
isnull
.SecurityException
- if the formatter could not be changed.
-