Top Description Fields Methods
org.osgi.service.log

public Interface Logger

Known Direct Subinterfaces
org.osgi.service.log.FormatterLogger
Annotations
@ProviderType
Imports
org.osgi.annotation.versioning.ProviderType

Provides methods for bundles to write messages to the log using SLF4J-style format strings.

Messages can be formatted by the Logger once the Logger determines the log level is enabled. Use a left curly bracket ('{' \u007B) followed by a right curly bracket ('}' \u007D) as a place holder for an argument: "{}". If you need to use the literal "{}" in the formatted message, precede the place holder with a reverse solidus ('\' \u005C): "\{}". If you need to place a backslash before the place holder, precede the reverse solidus with a reverse solidus: "\\{}".

You can also add a Throwable and/or ServiceReference to the generated LogEntry by passing them to the logging methods as additional arguments. If the last argument is a Throwable or a ServiceReference, it is added to the generated LogEntry and then, if the next to last argument is a ServiceReference or Throwable and not the same type as the last argument, it is also added to the generated LogEntry. These arguments will not be used as message arguments. For example:

logger.info("Found service {}.", serviceReference, serviceReference);
logger.warn("Something named {} happened.", name, serviceReference,
		throwable);
logger.error("Failed.", exception);
Author
$Id: df0972be1005fb5a009ffab7b8b59704d0ae2f94 $
Since
1.4

Field Summary

Modifier and TypeField and Description
public static final String
ROOT_LOGGER_NAME

Root Logger Name.

Method Summary

Modifier and TypeMethod and Description
public void
audit(String
The message to log.
message
)

Log a message at the LogLevel#AUDIT level.

public void
audit(String
The format of the message to log.
format
,
Object
The argument to format into the message.
arg
)

Log a formatted message at the LogLevel#AUDIT level.

public void
audit(String
The format of the message to log.
format
,
Object
The first argument to format into the message.
arg1
,
Object
The second argument to format into the message.
arg2
)

Log a formatted message at the LogLevel#AUDIT level.

public void
audit(String
The format of the message to log.
format
,
Object...
The arguments to format into the message.
arguments
)

Log a formatted message at the LogLevel#AUDIT level.

public void
debug(String
The message to log.
message
)

Log a message at the LogLevel#DEBUG level.

public void
debug(String
The format of the message to log.
format
,
Object
The argument to format into the message.
arg
)

Log a formatted message at the LogLevel#DEBUG level.

public void
debug(String
The format of the message to log.
format
,
Object
The first argument to format into the message.
arg1
,
Object
The second argument to format into the message.
arg2
)

Log a formatted message at the LogLevel#DEBUG level.

public void
debug(String
The format of the message to log.
format
,
Object...
The arguments to format into the message.
arguments
)

Log a formatted message at the LogLevel#DEBUG level.

public <E extends Exception> void
debug(LoggerConsumer<E>
The operation to perform on this Logger.
consumer
)

Perform the specified operation if logging enabled for the LogLevel#DEBUG level.

public void
error(String
The message to log.
message
)

Log a message at the LogLevel#ERROR level.

public void
error(String
The format of the message to log.
format
,
Object
The argument to format into the message.
arg
)

Log a formatted message at the LogLevel#ERROR level.

public void
error(String
The format of the message to log.
format
,
Object
The first argument to format into the message.
arg1
,
Object
The second argument to format into the message.
arg2
)

Log a formatted message at the LogLevel#ERROR level.

public void
error(String
The format of the message to log.
format
,
Object...
The arguments to format into the message.
arguments
)

Log a formatted message at the LogLevel#ERROR level.

public <E extends Exception> void
error(LoggerConsumer<E>
The operation to perform on this Logger.
consumer
)

Perform the specified operation if logging enabled for the LogLevel#ERROR level.

public String

Returns:

The name of this Logger.
getName
()

Return the name of this Logger.

public void
info(String
The message to log.
message
)

Log a message at the LogLevel#INFO level.

public void
info(String
The format of the message to log.
format
,
Object
The argument to format into the message.
arg
)

Log a formatted message at the LogLevel#INFO level.

public void
info(String
The format of the message to log.
format
,
Object
The first argument to format into the message.
arg1
,
Object
The second argument to format into the message.
arg2
)

Log a formatted message at the LogLevel#INFO level.

public void
info(String
The format of the message to log.
format
,
Object...
The arguments to format into the message.
arguments
)

Log a formatted message at the LogLevel#INFO level.

public <E extends Exception> void
info(LoggerConsumer<E>
The operation to perform on this Logger.
consumer
)

Perform the specified operation if logging enabled for the LogLevel#INFO level.

public boolean

Returns:

true if logging is enabled for the LogLevel#DEBUG level.
isDebugEnabled
()

Is logging enabled for the LogLevel#DEBUG level?

public boolean

Returns:

true if logging is enabled for the LogLevel#ERROR level.
isErrorEnabled
()

Is logging enabled for the LogLevel#ERROR level?

public boolean

Returns:

true if logging is enabled for the LogLevel#INFO level.
isInfoEnabled
()

Is logging enabled for the LogLevel#INFO level?

public boolean

Returns:

true if logging is enabled for the LogLevel#TRACE level.
isTraceEnabled
()

Is logging enabled for the LogLevel#TRACE level?

public boolean

Returns:

true if logging is enabled for the LogLevel#WARN level.
isWarnEnabled
()

Is logging enabled for the LogLevel#WARN level?

public void
trace(String
The message to log.
message
)

Log a message at the LogLevel#TRACE level.

public void
trace(String
The format of the message to log.
format
,
Object
The argument to format into the message.
arg
)

Log a formatted message at the LogLevel#TRACE level.

public void
trace(String
The format of the message to log.
format
,
Object
The first argument to format into the message.
arg1
,
Object
The second argument to format into the message.
arg2
)

Log a formatted message at the LogLevel#TRACE level.

public void
trace(String
The format of the message to log.
format
,
Object...
The arguments to format into the message.
arguments
)

Log a formatted message at the LogLevel#TRACE level.

public <E extends Exception> void
trace(LoggerConsumer<E>
The operation to perform on this Logger.
consumer
)

Perform the specified operation if logging enabled for the LogLevel#TRACE level.

public void
warn(String
The message to log.
message
)

Log a message at the LogLevel#WARN level.

public void
warn(String
The format of the message to log.
format
,
Object
The argument to format into the message.
arg
)

Log a formatted message at the LogLevel#WARN level.

public void
warn(String
The format of the message to log.
format
,
Object
The first argument to format into the message.
arg1
,
Object
The second argument to format into the message.
arg2
)

Log a formatted message at the LogLevel#WARN level.

public void
warn(String
The format of the message to log.
format
,
Object...
The arguments to format into the message.
arguments
)

Log a formatted message at the LogLevel#WARN level.

public <E extends Exception> void
warn(LoggerConsumer<E>
The operation to perform on this Logger.
consumer
)

Perform the specified operation if logging enabled for the LogLevel#WARN level.

Field Detail

ROOT_LOGGER_NAMEback to summary
public static final String ROOT_LOGGER_NAME

Root Logger Name.

Method Detail

auditback to summary
public void audit(String message)

Log a message at the LogLevel#AUDIT level.

Parameters
message:String

The message to log.

auditback to summary
public void audit(String format, Object arg)

Log a formatted message at the LogLevel#AUDIT level.

Parameters
format:String

The format of the message to log.

arg:Object

The argument to format into the message.

auditback to summary
public void audit(String format, Object arg1, Object arg2)

Log a formatted message at the LogLevel#AUDIT level.

Parameters
format:String

The format of the message to log.

arg1:Object

The first argument to format into the message.

arg2:Object

The second argument to format into the message.

auditback to summary
public void audit(String format, Object... arguments)

Log a formatted message at the LogLevel#AUDIT level.

Parameters
format:String

The format of the message to log.

arguments:Object[]

The arguments to format into the message.

debugback to summary
public void debug(String message)

Log a message at the LogLevel#DEBUG level.

Parameters
message:String

The message to log.

debugback to summary
public void debug(String format, Object arg)

Log a formatted message at the LogLevel#DEBUG level.

Parameters
format:String

The format of the message to log.

arg:Object

The argument to format into the message.

debugback to summary
public void debug(String format, Object arg1, Object arg2)

Log a formatted message at the LogLevel#DEBUG level.

Parameters
format:String

The format of the message to log.

arg1:Object

The first argument to format into the message.

arg2:Object

The second argument to format into the message.

debugback to summary
public void debug(String format, Object... arguments)

Log a formatted message at the LogLevel#DEBUG level.

Parameters
format:String

The format of the message to log.

arguments:Object[]

The arguments to format into the message.

debugback to summary
public <E extends Exception> void debug(LoggerConsumer<E> consumer) throws LoggerConsumer-:E

Perform the specified operation if logging enabled for the LogLevel#DEBUG level.

Parameters
consumer:LoggerConsumer<E>

The operation to perform on this Logger.

Exceptions
LoggerConsumer-:E:
An exception thrown by the operation.
errorback to summary
public void error(String message)

Log a message at the LogLevel#ERROR level.

Parameters
message:String

The message to log.

errorback to summary
public void error(String format, Object arg)

Log a formatted message at the LogLevel#ERROR level.

Parameters
format:String

The format of the message to log.

arg:Object

The argument to format into the message.

errorback to summary
public void error(String format, Object arg1, Object arg2)

Log a formatted message at the LogLevel#ERROR level.

Parameters
format:String

The format of the message to log.

arg1:Object

The first argument to format into the message.

arg2:Object

The second argument to format into the message.

errorback to summary
public void error(String format, Object... arguments)

Log a formatted message at the LogLevel#ERROR level.

Parameters
format:String

The format of the message to log.

arguments:Object[]

The arguments to format into the message.

errorback to summary
public <E extends Exception> void error(LoggerConsumer<E> consumer) throws LoggerConsumer-:E

Perform the specified operation if logging enabled for the LogLevel#ERROR level.

Parameters
consumer:LoggerConsumer<E>

The operation to perform on this Logger.

Exceptions
LoggerConsumer-:E:
An exception thrown by the operation.
getNameback to summary
public String getName()

Return the name of this Logger.

Returns:String

The name of this Logger.

infoback to summary
public void info(String message)

Log a message at the LogLevel#INFO level.

Parameters
message:String

The message to log.

infoback to summary
public void info(String format, Object arg)

Log a formatted message at the LogLevel#INFO level.

Parameters
format:String

The format of the message to log.

arg:Object

The argument to format into the message.

infoback to summary
public void info(String format, Object arg1, Object arg2)

Log a formatted message at the LogLevel#INFO level.

Parameters
format:String

The format of the message to log.

arg1:Object

The first argument to format into the message.

arg2:Object

The second argument to format into the message.

infoback to summary
public void info(String format, Object... arguments)

Log a formatted message at the LogLevel#INFO level.

Parameters
format:String

The format of the message to log.

arguments:Object[]

The arguments to format into the message.

infoback to summary
public <E extends Exception> void info(LoggerConsumer<E> consumer) throws LoggerConsumer-:E

Perform the specified operation if logging enabled for the LogLevel#INFO level.

Parameters
consumer:LoggerConsumer<E>

The operation to perform on this Logger.

Exceptions
LoggerConsumer-:E:
An exception thrown by the operation.
isDebugEnabledback to summary
public boolean isDebugEnabled()

Is logging enabled for the LogLevel#DEBUG level?

Returns:boolean

true if logging is enabled for the LogLevel#DEBUG level.

isErrorEnabledback to summary
public boolean isErrorEnabled()

Is logging enabled for the LogLevel#ERROR level?

Returns:boolean

true if logging is enabled for the LogLevel#ERROR level.

isInfoEnabledback to summary
public boolean isInfoEnabled()

Is logging enabled for the LogLevel#INFO level?

Returns:boolean

true if logging is enabled for the LogLevel#INFO level.

isTraceEnabledback to summary
public boolean isTraceEnabled()

Is logging enabled for the LogLevel#TRACE level?

Returns:boolean

true if logging is enabled for the LogLevel#TRACE level.

isWarnEnabledback to summary
public boolean isWarnEnabled()

Is logging enabled for the LogLevel#WARN level?

Returns:boolean

true if logging is enabled for the LogLevel#WARN level.

traceback to summary
public void trace(String message)

Log a message at the LogLevel#TRACE level.

Parameters
message:String

The message to log.

traceback to summary
public void trace(String format, Object arg)

Log a formatted message at the LogLevel#TRACE level.

Parameters
format:String

The format of the message to log.

arg:Object

The argument to format into the message.

traceback to summary
public void trace(String format, Object arg1, Object arg2)

Log a formatted message at the LogLevel#TRACE level.

Parameters
format:String

The format of the message to log.

arg1:Object

The first argument to format into the message.

arg2:Object

The second argument to format into the message.

traceback to summary
public void trace(String format, Object... arguments)

Log a formatted message at the LogLevel#TRACE level.

Parameters
format:String

The format of the message to log.

arguments:Object[]

The arguments to format into the message.

traceback to summary
public <E extends Exception> void trace(LoggerConsumer<E> consumer) throws LoggerConsumer-:E

Perform the specified operation if logging enabled for the LogLevel#TRACE level.

Parameters
consumer:LoggerConsumer<E>

The operation to perform on this Logger.

Exceptions
LoggerConsumer-:E:
An exception thrown by the operation.
warnback to summary
public void warn(String message)

Log a message at the LogLevel#WARN level.

Parameters
message:String

The message to log.

warnback to summary
public void warn(String format, Object arg)

Log a formatted message at the LogLevel#WARN level.

Parameters
format:String

The format of the message to log.

arg:Object

The argument to format into the message.

warnback to summary
public void warn(String format, Object arg1, Object arg2)

Log a formatted message at the LogLevel#WARN level.

Parameters
format:String

The format of the message to log.

arg1:Object

The first argument to format into the message.

arg2:Object

The second argument to format into the message.

warnback to summary
public void warn(String format, Object... arguments)

Log a formatted message at the LogLevel#WARN level.

Parameters
format:String

The format of the message to log.

arguments:Object[]

The arguments to format into the message.

warnback to summary
public <E extends Exception> void warn(LoggerConsumer<E> consumer) throws LoggerConsumer-:E

Perform the specified operation if logging enabled for the LogLevel#WARN level.

Parameters
consumer:LoggerConsumer<E>

The operation to perform on this Logger.

Exceptions
LoggerConsumer-:E:
An exception thrown by the operation.