public class LogConfigManager extends Object implements LogbackResetListener, LogConfig.LogWriterProvider
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_CONSOLE_APPENDER_NAME |
static String |
FACTORY_PID_CONFIGS |
static String |
FACTORY_PID_WRITERS |
static String |
LOG_ADDITIV |
static String |
LOG_FILE |
static String |
LOG_FILE_BUFFERED |
static String |
LOG_FILE_NUMBER |
static int |
LOG_FILE_NUMBER_DEFAULT |
static String |
LOG_FILE_SIZE |
static String |
LOG_FILE_SIZE_DEFAULT |
static String |
LOG_LEVEL |
static String |
LOG_LEVEL_DEFAULT |
static String |
LOG_LEVEL_RESET_TO_DEFAULT |
static String |
LOG_LOGGERS |
static String |
LOG_MAX_CLALLER_DEPTH |
static String |
LOG_PACKAGING_DATA |
static String |
LOG_PATTERN |
static String |
LOG_PATTERN_DEFAULT |
static String |
LOGBACK_FILE |
static String |
PID |
static String |
PRINTER_MAX_INCLUDED_FILES |
static int |
PRINTER_MAX_INCLUDED_FILES_DEFAULT |
static String |
PRINTER_NUM_OF_LINES |
static int |
PRINTER_NUM_OF_LINES_DEFAULT |
Constructor and Description |
---|
LogConfigManager(ch.qos.logback.classic.LoggerContext loggerContext,
org.osgi.framework.BundleContext bundleContext,
String rootDir,
LogbackManager logbackManager)
Sets up this log configuration manager by creating the default writers
and logger configuration
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Shuts this configuration manager down by dropping all references to
existing configurations, dropping all stored loggers and closing all log
writers.
|
ch.qos.logback.core.Appender<ch.qos.logback.classic.spi.ILoggingEvent> |
getDefaultAppender() |
LogWriter |
getDefaultWriter() |
File |
getLogbackConfigFile() |
Iterable<LogConfig> |
getLogConfigs() |
LogWriter |
getLogWriter(String logWriterName) |
Iterable<LogWriter> |
getLogWriters() |
int |
getMaxCallerDataDepth() |
int |
getMaxOldFileCount() |
int |
getNumOfLines()
Maximum number of lines from a log files to be included in txt mode dump
|
void |
internalFailure(String message,
Throwable t)
Logs a message an optional stack trace to error output.
|
boolean |
isPackagingDataEnabled() |
void |
onResetComplete(ch.qos.logback.classic.LoggerContext context) |
void |
onResetStart(ch.qos.logback.classic.LoggerContext context) |
void |
setDefaultConfiguration(Dictionary<String,String> defaultConfiguration)
Sets and applies the default configuration used by the
updateGlobalConfiguration(java.util.Dictionary) method if no
configuration is supplied. |
void |
updateGlobalConfiguration(Dictionary<String,String> configuration) |
void |
updateLoggerConfiguration(String pid,
Dictionary<?,?> configuration,
boolean performRefresh)
Updates or removes the logger configuration indicated by the given
pid . |
void |
updateLogWriter(String pid,
Dictionary<?,?> configuration,
boolean performRefresh)
Updates or removes the log writer configuration identified by the
pid . |
public static final String LOG_LEVEL
public static final String LOG_FILE
public static final String LOGBACK_FILE
public static final String LOG_FILE_NUMBER
public static final String LOG_FILE_SIZE
public static final String LOG_FILE_BUFFERED
public static final String LOG_PATTERN
public static final String LOG_PATTERN_DEFAULT
public static final String LOG_LOGGERS
public static final String LOG_ADDITIV
public static final String LOG_PACKAGING_DATA
public static final String LOG_MAX_CLALLER_DEPTH
public static final String PRINTER_MAX_INCLUDED_FILES
public static final int PRINTER_MAX_INCLUDED_FILES_DEFAULT
public static final String PRINTER_NUM_OF_LINES
public static final int PRINTER_NUM_OF_LINES_DEFAULT
public static final String LOG_LEVEL_DEFAULT
public static final String LOG_LEVEL_RESET_TO_DEFAULT
public static final int LOG_FILE_NUMBER_DEFAULT
public static final String LOG_FILE_SIZE_DEFAULT
public static final String PID
public static final String FACTORY_PID_WRITERS
public static final String FACTORY_PID_CONFIGS
public static final String DEFAULT_CONSOLE_APPENDER_NAME
public LogConfigManager(ch.qos.logback.classic.LoggerContext loggerContext, org.osgi.framework.BundleContext bundleContext, String rootDir, LogbackManager logbackManager)
public void internalFailure(String message, Throwable t)
public void setDefaultConfiguration(Dictionary<String,String> defaultConfiguration)
updateGlobalConfiguration(java.util.Dictionary)
method if no
configuration is supplied.public void close()
After this methods is called, this instance should not be used again.
public LogWriter getLogWriter(String logWriterName)
getLogWriter
in interface LogConfig.LogWriterProvider
public File getLogbackConfigFile()
public ch.qos.logback.core.Appender<ch.qos.logback.classic.spi.ILoggingEvent> getDefaultAppender()
public void onResetStart(ch.qos.logback.classic.LoggerContext context)
onResetStart
in interface LogbackResetListener
public void onResetComplete(ch.qos.logback.classic.LoggerContext context)
onResetComplete
in interface LogbackResetListener
public void updateGlobalConfiguration(Dictionary<String,String> configuration) throws ConfigurationException
ConfigurationException
public void updateLogWriter(String pid, Dictionary<?,?> configuration, boolean performRefresh) 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:
LOG_FILE
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 LOG_FILE_SIZE_DEFAULT
is assumed. If the writer writes standard output this property is
ignored.LOG_FILE_NUMBER
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, boolean performRefresh) 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:
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
LOG_PATTERN_DEFAULT
is used.LOG_LEVEL
off
, 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.LOG_LOGGERS
ConfigurationException
is thrown.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.public boolean isPackagingDataEnabled()
public int getMaxCallerDataDepth()
public int getMaxOldFileCount()
public int getNumOfLines()
public LogWriter getDefaultWriter()
Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.