Package org.apache.felix.scr.impl.logger
Class AbstractLogger
- java.lang.Object
-
- org.apache.felix.scr.impl.logger.AbstractLogger
-
- Direct Known Subclasses:
ComponentLogger,LogServiceEnabledLogger
public abstract class AbstractLogger extends java.lang.ObjectThis is a common base for all loggers
-
-
Field Summary
Fields Modifier and Type Field Description private ScrConfigurationconfigprivate java.lang.StringprefixThe prefix put for each log message
-
Constructor Summary
Constructors Constructor Description AbstractLogger(ScrConfiguration config, java.lang.String prefix)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description private java.lang.Stringformat(java.lang.String pattern, java.lang.Object... arguments)(package private) static java.lang.StringgetBundleIdentifier(org.osgi.framework.Bundle bundle)(package private) ScrConfigurationgetConfiguration()(package private) abstract InternalLoggergetLogger()Get the internal logger(package private) java.lang.StringgetPrefix()booleanisLogEnabled(int level)Returnstrueif logging for the given level is enabled.booleanlog(int level, java.lang.String message, java.lang.Throwable ex)Method to actually emit the log message.booleanlog(int level, java.lang.String pattern, java.lang.Throwable ex, java.lang.Object... arguments)Method to actually emit the log message.(package private) voidsetPrefix(java.lang.String value)
-
-
-
Field Detail
-
config
private final ScrConfiguration config
-
prefix
private volatile java.lang.String prefix
The prefix put for each log message
-
-
Constructor Detail
-
AbstractLogger
AbstractLogger(ScrConfiguration config, java.lang.String prefix)
-
-
Method Detail
-
getConfiguration
ScrConfiguration getConfiguration()
-
setPrefix
void setPrefix(java.lang.String value)
-
getPrefix
java.lang.String getPrefix()
-
getLogger
abstract InternalLogger getLogger()
Get the internal logger- Returns:
- The internal logger
-
isLogEnabled
public boolean isLogEnabled(int level)
Returnstrueif logging for the given level is enabled.
-
log
public boolean log(int level, java.lang.String pattern, java.lang.Throwable ex, java.lang.Object... arguments)Method to actually emit the log message. If the LogService is available, the message will be logged through the LogService. Otherwise the message is logged to stdout (or stderr in case of LOG_ERROR level messages),- Parameters:
level- The log level to log the message atpattern- Thejava.text.MessageFormatmessage format string for preparing the messageex- An optionalThrowablewhose stack trace is written,arguments- The format arguments for thepatternstring.
-
log
public boolean log(int level, java.lang.String message, java.lang.Throwable ex)Method to actually emit the log message. If the LogService is available, the message will be logged through the LogService. Otherwise the message is logged to stdout (or stderr in case of LOG_ERROR level messages),- Parameters:
level- The log level of the messages. This corresponds to the log levels defined by the OSGi LogService.message- The message to printex- TheThrowablecausing the message to be logged.
-
getBundleIdentifier
static java.lang.String getBundleIdentifier(org.osgi.framework.Bundle bundle)
-
format
private java.lang.String format(java.lang.String pattern, java.lang.Object... arguments)
-
-