|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.sling.commons.log.internal.slf4j.LogConfigManager
public class LogConfigManager
Field Summary | |
---|---|
static String |
ROOT
|
Method Summary | |
---|---|
void |
close()
Shuts this configuration manager down by dropping all references to existing configurations, dropping all stored loggers and closing all log writers. |
static LogConfigManager |
getInstance()
Returns the single instance of this log configuration instance. |
org.slf4j.Logger |
getLogger(String name)
Returns the name logger. |
static void |
internalFailure(String message,
Throwable t)
Logs a message an optional stack trace to error output. |
void |
setDefaultConfiguration(Dictionary<String,String> defaultConfiguration)
Sets and applies the default configuration used by the updateGlobalConfiguration(Dictionary) method if no configuration
is supplied. |
void |
setRoot(String root)
Sets the root (folder) to be used to make relative paths absolute. |
void |
updateGlobalConfiguration(Dictionary<String,String> configuration)
|
void |
updateLoggerConfiguration(String pid,
Dictionary<?,?> configuration)
Updates or removes the logger configuration indicated by the given pid . |
void |
updateLogWriter(String pid,
Dictionary<?,?> configuration)
Updates or removes the log writer configuration identified by the pid . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String ROOT
Method Detail |
---|
public static LogConfigManager getInstance()
public static void internalFailure(String message, Throwable t)
public void setRoot(String root)
public void setDefaultConfiguration(Dictionary<String,String> defaultConfiguration)
updateGlobalConfiguration(Dictionary)
method if no configuration
is supplied.
public void close()
After this methods is called, this instance should not be used again.
public org.slf4j.Logger getLogger(String name)
getLogger
in interface org.slf4j.ILoggerFactory
public void updateGlobalConfiguration(Dictionary<String,String> configuration) throws ConfigurationException
ConfigurationException
public void updateLogWriter(String pid, Dictionary<?,?> configuration) throws ConfigurationException
pid
. In case of log writer removal, any logger
configuration referring to the removed log writer is modified to now log
to the default log writer.
The configuration object is expected to contain the following properties:
LogManager.LOG_FILE
LogManager.LOG_FILE_SIZE
k
,
kb
, m
, mb
, g
or gb
representing the respective factors of kilo, mega
and giga.If this property is missing or cannot be converted to a number,
the default value LogManager.LOG_FILE_SIZE_DEFAULT
is assumed. If
the writer writes standard output this property is ignored.LogManager.LOG_FILE_NUMBER
LogManager.LOG_FILE_NUMBER_DEFAULT
is assumed. If the writer
writes standard output this property is ignored.
pid
- The identifier of the log writer to update or removeconfiguration
- New configuration setting for the log writer or
null
to indicate to remove the log writer.
ConfigurationException
- If another log writer already exists for
the same file as configured for the given log writer or if
configuring the log writer fails.public void updateLoggerConfiguration(String pid, Dictionary<?,?> configuration) throws ConfigurationException
pid
. If the case of modified categories or removal of the
logger configuration, existing loggers will be modified to reflect the
correct logger configurations available.
The configuration object is expected to contain the following properties:
LogManager.LOG_PATTERN
MessageFormat
pattern to apply to format the log
message before writing it to the log writer. If this property is missing
or the empty string the default pattern
LogManager.LOG_PATTERN_DEFAULT
is used.LogManager.LOG_LEVEL
trace
, debug
,
info
, warn
and error
. Case
does not matter. If this property is missing a
ConfigurationException
is thrown and this logger
configuration is not used.LogManager.LOG_LOGGERS
ConfigurationException
is thrown.LogManager.LOG_FILE
pid
- The name of the configuration to update or remove.configuration
- The configuration object.
ConfigurationException
- If the log level and logger names
properties are not configured for the given configuration.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |