Class Initializer
Object
Initializer
Loads a logging configuration file using Java logging syntax augmented with Apache SIS extensions.
The
"java.util.logging.config.file"
system property
must be set to the path of a properties file containing configuration
in the format described by LogManager
.
This class applies the following filtering on the configuration file:
- Changes in
"java.util.logging.FileHandler.pattern"
property value:- Replace
%p
by the parent directory of the logging configuration file.
- Replace
Example
Given an application with the following directory structure:application ├─ conf/ │ └─ logging.properties └─ log/If the
logging.properties
contains the following line:
java.util.logging.FileHandler.pattern = %p/log/myapp.logThen the
%p
characters of that property value will be replaced by the path to the
application
directory, thus allowing the application to log in the log/
sub-directory.
Other special components such as %t
, %h
, %g
or %u
are handled as usual
(i.e. as documented by FileHandler
).
Usage
This class should not be referenced directly by other Java code. Instead, it can be specified at JVM startup time like below:java -Djava.util.logging.config.class=org.apache.sis.util.logging.Initializer \ -Djava.util.logging.config.file=path/to/my/application/conf/logging.propertiesSee for example the
bin/sis
shell script in Apache SIS binary distribution.- Since:
- 1.3
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The system property for the logging configuration file. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
CONFIG_FILE_PROPERTY
The system property for the logging configuration file. The value is defined byLogManager
to "java.util.logging.config.file".- Since:
- 1.5
- See Also:
-
-
Constructor Details
-
Initializer
Configures Java logging using a filtered configuration file. This constructor gets the configuration file referenced by the "java.util.logging.config.file" system property, applies the filtering described in class javadoc, then gives the filtered configuration toLogManager.readConfiguration(InputStream)
.This constructor should not be invoked directly. See class javadoc for usage example.
- Throws:
IOException
- if an error occurred while reading the configuration file.
-
-
Method Details
-
reload
Reloads the logging configuration from the specified file. The new configuration replaces the previous one (this is not an update). The extended pattern ("%p"
) is parsed as described in the class summary.- Parameters:
path
- path to the logging configuration file.- Throws:
IOException
- if an error occurred while reading the configuration file.- Since:
- 1.5
- See Also:
-