Package org.jboss.logmanager
Class PropertyConfigurator
- java.lang.Object
-
- org.jboss.logmanager.PropertyConfigurator
-
- All Implemented Interfaces:
Configurator
public final class PropertyConfigurator extends java.lang.Object implements Configurator
A configurator which uses a simple property file format.
-
-
Field Summary
-
Fields inherited from interface org.jboss.logmanager.Configurator
ATTACHMENT_KEY
-
-
Constructor Summary
Constructors Constructor Description PropertyConfigurator()Construct an instance.PropertyConfigurator(LogContext context)Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconfigure(java.io.InputStream inputStream)Configure the logmanager.voidconfigure(java.util.Properties properties)Configure the log manager from the given properties.LogContextConfigurationgetLogContextConfiguration()Get the log context configuration.voidwriteConfiguration(java.io.OutputStream outputStream)Writes the current configuration to the output stream.voidwriteConfiguration(java.io.OutputStream outputStream, boolean writeExpressions)Writes the current configuration to the output stream.
-
-
-
Constructor Detail
-
PropertyConfigurator
public PropertyConfigurator()
Construct an instance.
-
PropertyConfigurator
public PropertyConfigurator(LogContext context)
Construct a new instance.- Parameters:
context- the log context to be configured
-
-
Method Detail
-
getLogContextConfiguration
public LogContextConfiguration getLogContextConfiguration()
Get the log context configuration. WARNING: this instance is not thread safe in any way. The returned object should never be used from more than one thread at a time; furthermore thewriteConfiguration(java.io.OutputStream)method also accesses this object directly.- Returns:
- the log context configuration instance
-
configure
public void configure(java.io.InputStream inputStream) throws java.io.IOExceptionConfigure the logmanager.- Specified by:
configurein interfaceConfigurator- Parameters:
inputStream- the input stream to read- Throws:
java.io.IOException- if an error occurs
-
writeConfiguration
public void writeConfiguration(java.io.OutputStream outputStream) throws java.io.IOExceptionWrites the current configuration to the output stream. Note: the output stream will be closed.- Parameters:
outputStream- the output stream to write to.- Throws:
java.io.IOException- if an error occurs while writing the configuration.
-
writeConfiguration
public void writeConfiguration(java.io.OutputStream outputStream, boolean writeExpressions) throws java.io.IOExceptionWrites the current configuration to the output stream. Note: the output stream will be closed.- Parameters:
outputStream- the output stream to write to.writeExpressions-trueif expressions should be written,falseif the resolved value should be written- Throws:
java.io.IOException- if an error occurs while writing the configuration.
-
configure
public void configure(java.util.Properties properties) throws java.io.IOExceptionConfigure the log manager from the given properties. The following values read in from a configuration will be trimmed of prefixed and trailing whitespace:- logger.NAME.filter
- logger.NAME.level
- logger.NAME.useParentHandlers
- handler.NAME.filter
- handler.NAME.formatter
- handler.NAME.level
- handler.NAME.encoding
- handler.NAME.errorManager
writtenthe trimmed values will be written for the above properties.- Parameters:
properties- the properties- Throws:
java.io.IOException- if an error occurs
-
-