org.apache.felix.ipojo.util
Class Logger

java.lang.Object
  extended by org.apache.felix.ipojo.util.Logger

public class Logger
extends Object

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
static int DEBUG
          The Log Level DEBUG.
static int ERROR
          The Log Level ERROR.
static int INFO
          The Log Level INFO.
static String IPOJO_LOG_LEVEL_HEADER
          iPOJO log level manifest header.
static String IPOJO_LOG_LEVEL_PROP
          The iPOJO default log level property.
static int WARNING
          The Log Level WARNING.
 
Constructor Summary
Logger(BundleContext context, ComponentInstance instance)
          Create a logger.
Logger(BundleContext context, ComponentInstance instance, int level)
          Creates a logger.
Logger(BundleContext context, String name)
          Create a logger.
Logger(BundleContext context, String name, int level)
          Creates a logger.
 
Method Summary
 void log(int level, String msg)
          Logs a message.
 void log(int level, String msg, 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 String IPOJO_LOG_LEVEL_PROP
The iPOJO default log level property.

See Also:
Constant Field Values

IPOJO_LOG_LEVEL_HEADER

public static final 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

ERROR

public static final int ERROR
The Log Level ERROR.

See Also:
Constant Field Values

WARNING

public static final int WARNING
The Log Level WARNING.

See Also:
Constant Field Values

INFO

public static final int INFO
The Log Level INFO.

See Also:
Constant Field Values

DEBUG

public static final int DEBUG
The Log Level DEBUG.

See Also:
Constant Field Values
Constructor Detail

Logger

public Logger(BundleContext context,
              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(BundleContext context,
              ComponentInstance instance,
              int level)
Creates a logger.

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

Logger

public Logger(BundleContext context,
              String name)
Create a logger. Uses the default logger level.

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

Logger

public Logger(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,
                String msg)
Logs a message.

Parameters:
level - the level of the message
msg - the the message to log

log

public void log(int level,
                String msg,
                Throwable exception)
Logs a message with an exception.

Parameters:
level - the level of the message
msg - the message to log
exception - the exception attached to the message


Copyright © 2011 Apache Software Foundation. All Rights Reserved.