org.apache.felix.ipojo.util

## Class Logger

- java.lang.Object
- - org.apache.felix.ipojo.util.Logger

All Implemented Interfaces:
  Log

    public class Logger
    extends java.lang.Object
    implements Log

iPOJO Logger. This class is an helper class implementing a simple log system. This logger sends log messages to a log service if available.

Author:
  Felix Project Team

### Field Summary

Fields
`static java.lang.String` `IPOJO_LOG_LEVEL_HEADER` iPOJO log level manifest header.
`static java.lang.String` `IPOJO_LOG_LEVEL_PROP` The iPOJO default log level property.

### Fields inherited from interface org.apache.felix.ipojo.util.Log

`DEBUG, ERROR, INFO, WARNING`

### Constructor Summary

Constructors
Constructor and Description
`Logger(org.osgi.framework.BundleContext context, ComponentInstance instance)` Create a logger.
`Logger(org.osgi.framework.BundleContext context, ComponentInstance instance, int level)` Creates a logger.
`Logger(org.osgi.framework.BundleContext context, java.lang.String name)` Create a logger.
`Logger(org.osgi.framework.BundleContext context, java.lang.String name, int level)` Creates a logger.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `log(int level, java.lang.String msg)` Logs a message.
`void` `log(int level, java.lang.String msg, java.lang.Throwable exception)` Logs a message with an exception.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### IPOJO_LOG_LEVEL_PROP

    public static final java.lang.String IPOJO_LOG_LEVEL_PROP

The iPOJO default log level property.

See Also:
  Constant Field Values

#### IPOJO_LOG_LEVEL_HEADER

    public static final java.lang.String IPOJO_LOG_LEVEL_HEADER

iPOJO log level manifest header. The uppercase 'I' is important as BND removes all headers that do not start with an uppercase are not added to the bundle. Use an upper case to support bnd.

See Also:
  Constant Field Values

### Constructor Detail

#### Logger

    public Logger(org.osgi.framework.BundleContext context,
                  java.lang.String name,
                  int level)

Creates a logger.

Parameters:
  `context` - the bundle context
  `name` - the name of the logger
  `level` - the trace level

#### Logger

    public Logger(org.osgi.framework.BundleContext context,
                  ComponentInstance instance,
                  int level)

Creates a logger.

Parameters:
  `context` - the bundle context
  `instance` - the instance
  `level` - the trace level

#### Logger

    public Logger(org.osgi.framework.BundleContext context,
                  java.lang.String name)

Create a logger. Uses the default logger level.

Parameters:
  `context` - the bundle context
  `name` - the name of the logger

#### Logger

    public Logger(org.osgi.framework.BundleContext context,
                  ComponentInstance instance)

Create a logger. Uses the default logger level.

Parameters:
  `context` - the bundle context
  `instance` - the instance

### Method Detail

#### log

    public void log(int level,
                    java.lang.String msg)

Logs a message.

Specified by:
  `log` in interface `Log`
Parameters:
  `level` - the level of the message
  `msg` - the the message to log

#### log

    public void log(int level,
                    java.lang.String msg,
                    java.lang.Throwable exception)

Logs a message with an exception.

Specified by:
  `log` in interface `Log`
Parameters:
  `level` - the level of the message
  `msg` - the message to log
  `exception` - the exception attached to the message