public class ExtendedLogServiceImpl extends Object implements ExtendedLogService, LogService
LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_WARNING
Constructor and Description |
---|
ExtendedLogServiceImpl(ExtendedLogServiceFactory factory,
Bundle bundle) |
Modifier and Type | Method and Description |
---|---|
Logger |
getLogger(Bundle logBundle,
String name)
Returns the logger associated with this logger name and bundle.
|
Logger |
getLogger(String name)
Returns the
Logger |
String |
getName()
Returns the name associated with this
Logger
object. |
boolean |
isLoggable(int level)
Pre-checks if there are LogListeners who are listening for a matching log entry from this
Logger . |
void |
log(int level,
String message)
Logs a message.
|
void |
log(int level,
String message,
Throwable exception)
Logs a message with an exception.
|
void |
log(Object context,
int level,
String message)
Extends the
LogService
Logs a message with a context object |
void |
log(Object context,
int level,
String message,
Throwable exception)
Logs a message with an exception associated and a
context object.
|
void |
log(ServiceReference sr,
int level,
String message)
Logs a message associated with a specific
ServiceReference
object. |
void |
log(ServiceReference sr,
int level,
String message,
Throwable exception)
Logs a message with an exception associated and a
ServiceReference object. |
public ExtendedLogServiceImpl(ExtendedLogServiceFactory factory, Bundle bundle)
public void log(int level, String message)
LogService
The ServiceReference
field and the Throwable
field
of the LogEntry
object will be set to null
.
log
in interface Logger
log
in interface LogService
level
- The severity of the message. This should be one of the
defined log levels but may be any integer that is interpreted in a
user defined way.message
- Human readable string describing the condition or
null
.LogService.LOG_ERROR
,
LogService.LOG_WARNING
,
LogService.LOG_INFO
,
LogService.LOG_DEBUG
public void log(int level, String message, Throwable exception)
LogService
The ServiceReference
field of the LogEntry
object
will be set to null
.
log
in interface Logger
log
in interface LogService
level
- The severity of the message. This should be one of the
defined log levels but may be any integer that is interpreted in a
user defined way.message
- The human readable string describing the condition or
null
.exception
- The exception that reflects the condition or
null
.LogService.LOG_ERROR
,
LogService.LOG_WARNING
,
LogService.LOG_INFO
,
LogService.LOG_DEBUG
public void log(ServiceReference sr, int level, String message)
LogService
ServiceReference
object.
The Throwable
field of the LogEntry
will be set to
null
.
log
in interface Logger
log
in interface LogService
sr
- The ServiceReference
object of the service that this
message is associated with or null
.level
- The severity of the message. This should be one of the
defined log levels but may be any integer that is interpreted in a
user defined way.message
- Human readable string describing the condition or
null
.LogService.LOG_ERROR
,
LogService.LOG_WARNING
,
LogService.LOG_INFO
,
LogService.LOG_DEBUG
public void log(ServiceReference sr, int level, String message, Throwable exception)
LogService
ServiceReference
object.log
in interface Logger
log
in interface LogService
sr
- The ServiceReference
object of the service that this
message is associated with.level
- The severity of the message. This should be one of the
defined log levels but may be any integer that is interpreted in a
user defined way.message
- Human readable string describing the condition or
null
.exception
- The exception that reflects the condition or
null
.LogService.LOG_ERROR
,
LogService.LOG_WARNING
,
LogService.LOG_INFO
,
LogService.LOG_DEBUG
public void log(Object context, int level, String message)
Logger
LogService
Logs a message with a context objectlog
in interface Logger
context
- The context object this message is associated with.level
- The log level or severity of the message.message
- A human readable string to associate with log entry.LogService.log(int, String)
public void log(Object context, int level, String message, Throwable exception)
Logger
log
in interface Logger
context
- The context object this message is associated with.level
- The log level or severity of the message.message
- A human readable string to associate with log entry.exception
- The exception associated with this entryLogService.log(int, String, Throwable)
public Logger getLogger(String name)
ExtendedLogService
Logger object associated with this logger name for the bundle that retrieved this log service.
If loggerName is null the default Logger
for this bundle is returned.
getLogger
in interface ExtendedLogService
name
- The logger name.Logger
associated with the logger name.public Logger getLogger(Bundle logBundle, String name)
ExtendedLogService
getLogger
in interface ExtendedLogService
logBundle
- The bundles associated with this logger. If null the bundle that retrieved this log service is used.name
- The logger name.Logger
associated with the logger name.public String getName()
Logger
Logger
object.public boolean isLoggable(int level)
Logger
Logger
.isLoggable
in interface Logger
level
- The log level or severity of the message.boolean
True if there a LogListener listening that can handle a log entry for this log level; false otherwise.ExtendedLogReaderService.addLogListener(org.osgi.service.log.LogListener, LogFilter)
,
LogFilter
Copyright © 2007–2018 The Apache Software Foundation. All rights reserved.