Package org.apache.felix.scr.impl.logger
Class AbstractLogger
java.lang.Object
org.apache.felix.scr.impl.logger.AbstractLogger
- Direct Known Subclasses:
ComponentLogger,LogServiceEnabledLogger
This is a common base for all loggers
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ScrConfigurationprivate StringThe prefix put for each log message -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate String(package private) static StringgetBundleIdentifier(org.osgi.framework.Bundle bundle) (package private) ScrConfiguration(package private) abstract InternalLoggerGet the internal logger(package private) StringbooleanisLogEnabled(int level) Returnstrueif logging for the given level is enabled.booleanMethod to actually emit the log message.booleanMethod to actually emit the log message.(package private) void
-
Field Details
-
config
-
prefix
The prefix put for each log message
-
-
Constructor Details
-
AbstractLogger
AbstractLogger(ScrConfiguration config, String prefix)
-
-
Method Details
-
getConfiguration
ScrConfiguration getConfiguration() -
setPrefix
-
getPrefix
String getPrefix() -
getLogger
Get the internal logger- Returns:
- The internal logger
-
isLogEnabled
public boolean isLogEnabled(int level) Returnstrueif logging for the given level is enabled. -
log
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
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
-
format
-