public class ComponentLogger extends AbstractLogger
ComponentLogger 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 like ComponentMetadata or the component Id.| Constructor and Description |
|---|
ComponentLogger(ComponentMetadata metadata,
BundleLogger parent) |
| Modifier and Type | Method and 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.
|
isLogEnabledpublic ComponentLogger(ComponentMetadata metadata, BundleLogger parent)
public void setComponentId(long id)
id - The component idpublic boolean log(int level,
String pattern,
Throwable ex,
Object... arguments)
AbstractLoggerlog in class AbstractLoggerlevel - The log level to log the message atpattern - The java.text.MessageFormat message format
string for preparing the messageex - An optional Throwable whose stack trace is written,arguments - The format arguments for the pattern
string.public boolean log(int level,
String message,
Throwable ex)
AbstractLoggerlog in class AbstractLoggerlevel - The log level of the messages. This corresponds to the log
levels defined by the OSGi LogService.message - The message to printex - The Throwable causing the message to be logged.Copyright © 2006–2020 The Apache Software Foundation. All rights reserved.