Package org.osgi.service.log

# Interface LogService

All Superinterfaces:
  `LoggerFactory`

@ProviderType public interface LogService extends LoggerFactory
LogService for logging information.

Replaced by `LoggerFactory`.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`LOG_DEBUG`
Deprecated.
Since 1.4.
`static final int`
`LOG_ERROR`
Deprecated.
Since 1.4.
`static final int`
`LOG_INFO`
Deprecated.
Since 1.4.
`static final int`
`LOG_WARNING`
Deprecated.
Since 1.4.

## Method Summary

Modifier and Type
Method
Description
`void`
`log(int level, String message)`
Deprecated.
Since 1.4.
`void`
`log(int level, String message, Throwable exception)`
Deprecated.
Since 1.4.
`void`
`log(ServiceReference<?> sr, int level, String message)`
Deprecated.
Since 1.4.
`void`
`log(ServiceReference<?> sr, int level, String message, Throwable exception)`
Deprecated.
Since 1.4.

### Methods inherited from interface org.osgi.service.log.LoggerFactory

`getLogger, getLogger, getLogger, getLogger, getLogger`

## Field Details

### LOG_ERROR

@Deprecated static final int LOG_ERROR
Deprecated.
Since 1.4. Replaced by `LogLevel.ERROR`.
An error message (Value 1).

This log entry indicates the bundle or service may not be functional.

See Also:
  - Constant Field Values

### LOG_WARNING

@Deprecated static final int LOG_WARNING
Deprecated.
Since 1.4. Replaced by `LogLevel.WARN`.
A warning message (Value 2).

This log entry indicates a bundle or service is still functioning but may experience problems in the future because of the warning condition.

See Also:
  - Constant Field Values

### LOG_INFO

@Deprecated static final int LOG_INFO
Deprecated.
Since 1.4. Replaced by `LogLevel.INFO`.
An informational message (Value 3).

This log entry may be the result of any change in the bundle or service and does not indicate a problem.

See Also:
  - Constant Field Values

### LOG_DEBUG

@Deprecated static final int LOG_DEBUG
Deprecated.
Since 1.4. Replaced by `LogLevel.DEBUG`.
A debugging message (Value 4).

This log entry is used for problem determination and may be irrelevant to anyone but the bundle developer.

See Also:
  - Constant Field Values

## Method Details

### log

@Deprecated void log(int level, String message)
Deprecated.
Since 1.4. Replaced by `Logger`. See `LoggerFactory`.
Logs a message.

The `ServiceReference` field and the `Throwable` field of the `LogEntry` object will be set to `null`.

This method will log to the bundle's `Logger` named `"LogService.<bsn>"` where `<bsn>` is the Bundle Symbolic Name of the bundle.

The specified level is mapped to a `LogLevel` as follows:

- `LOG_ERROR` - `LogLevel.ERROR`
- `LOG_WARNING` - `LogLevel.WARN`
- `LOG_INFO` - `LogLevel.INFO`
- `LOG_DEBUG` - `LogLevel.DEBUG`
- Any other value - `LogLevel.TRACE`

In the generated log entry, `LogEntry.getLevel()` must return the specified level.

Parameters:
  `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`.

### log

@Deprecated void log(int level, String message, Throwable exception)
Deprecated.
Since 1.4. Replaced by `Logger`. See `LoggerFactory`.
Logs a message with an exception.

The `ServiceReference` field of the `LogEntry` object will be set to `null`.

This method will log to the bundle's `Logger` named `"LogService.<bsn>"` where `<bsn>` is the Bundle Symbolic Name of the bundle.

The specified level is mapped to a `LogLevel` as follows:

- `LOG_ERROR` - `LogLevel.ERROR`
- `LOG_WARNING` - `LogLevel.WARN`
- `LOG_INFO` - `LogLevel.INFO`
- `LOG_DEBUG` - `LogLevel.DEBUG`
- Any other value - `LogLevel.TRACE`

In the generated log entry, `LogEntry.getLevel()` must return the specified level.

Parameters:
  `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`.

### log

@Deprecated void log(ServiceReference<?> sr, int level, String message)
Deprecated.
Since 1.4. Replaced by `Logger`. See `LoggerFactory`.
Logs a message associated with a specific `ServiceReference` object.

The `Throwable` field of the `LogEntry` will be set to `null`.

This method will log to the bundle's `Logger` named `"LogService.<bsn>"` where `<bsn>` is the Bundle Symbolic Name of the bundle.

The specified level is mapped to a `LogLevel` as follows:

- `LOG_ERROR` - `LogLevel.ERROR`
- `LOG_WARNING` - `LogLevel.WARN`
- `LOG_INFO` - `LogLevel.INFO`
- `LOG_DEBUG` - `LogLevel.DEBUG`
- Any other value - `LogLevel.TRACE`

In the generated log entry, `LogEntry.getLevel()` must return the specified level.

Parameters:
  `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`.

### log

@Deprecated void log(ServiceReference<?> sr, int level, String message, Throwable exception)
Deprecated.
Since 1.4. Replaced by `Logger`. See `LoggerFactory`.
Logs a message with an exception associated and a `ServiceReference` object.

This method will log to the bundle's `Logger` named `"LogService.<bsn>"` where `<bsn>` is the Bundle Symbolic Name of the bundle.

The specified level is mapped to a `LogLevel` as follows:

- `LOG_ERROR` - `LogLevel.ERROR`
- `LOG_WARNING` - `LogLevel.WARN`
- `LOG_INFO` - `LogLevel.INFO`
- `LOG_DEBUG` - `LogLevel.DEBUG`
- Any other value - `LogLevel.TRACE`

In the generated log entry, `LogEntry.getLevel()` must return the specified level.

Parameters:
  `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`.