Package org.apache.felix.scr.impl.logger
Class ComponentLogger
- java.lang.Object
-
- org.apache.felix.scr.impl.logger.AbstractLogger
-
- org.apache.felix.scr.impl.logger.ComponentLogger
-
public class ComponentLogger extends AbstractLogger
TheComponentLogger
is the logger to be used to log on behalf of a component. This avoids avoids that all clients doing logging on behalf of a component need to pass in things likeComponentMetadata
or the component Id.
-
-
Constructor Summary
Constructors Constructor Description ComponentLogger(ComponentMetadata metadata, BundleLogger parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
log(int level, String message, Throwable ex)
Method to actually emit the log message.boolean
log(int level, String pattern, Throwable ex, Object... arguments)
Method to actually emit the log message.void
setComponentId(long id)
Update the logger with the correct component id.-
Methods inherited from class org.apache.felix.scr.impl.logger.AbstractLogger
isLogEnabled
-
-
-
-
Constructor Detail
-
ComponentLogger
public ComponentLogger(ComponentMetadata metadata, BundleLogger parent)
-
-
Method Detail
-
setComponentId
public void setComponentId(long id)
Update the logger with the correct component id.- Parameters:
id
- The component id
-
log
public boolean log(int level, String pattern, Throwable ex, Object... arguments)
Description copied from class:AbstractLogger
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),- Overrides:
log
in classAbstractLogger
- Parameters:
level
- The log level to log the message atpattern
- Thejava.text.MessageFormat
message format string for preparing the messageex
- An optionalThrowable
whose stack trace is written,arguments
- The format arguments for thepattern
string.
-
log
public boolean log(int level, String message, Throwable ex)
Description copied from class:AbstractLogger
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),- Overrides:
log
in classAbstractLogger
- Parameters:
level
- The log level of the messages. This corresponds to the log levels defined by the OSGi LogService.message
- The message to printex
- TheThrowable
causing the message to be logged.
-
-