org.apache.cocoon.core.osgi
Class OSGiLoggerManager

java.lang.Object
  extended byorg.apache.cocoon.core.osgi.OSGiLoggerManager
All Implemented Interfaces:
LoggerManager

public class OSGiLoggerManager
extends Object
implements LoggerManager

An implementation of Avalon's LoggerManager on top of OSGi's LogService. OSGi's service provides no way to check if a particular log level is enabled. Rather than always considering all levels to be enabled, which can lead to useless expensive expressions, the maximum log level is given at manager creation time, and is uses by all log categories within the bundle.

Since:
2.2
Version:
$Id: OSGiLoggerManager.java 312637 2005-10-10 13:00:42Z cziegeler $

Field Summary
 
Fields inherited from interface org.apache.avalon.excalibur.logger.LoggerManager
ROLE
 
Constructor Summary
OSGiLoggerManager(org.osgi.framework.BundleContext ctx, int maxLevel)
          Create an OSGiLoggerManager.
 
Method Summary
 Logger getDefaultLogger()
           
 Logger getLoggerForCategory(String category)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OSGiLoggerManager

public OSGiLoggerManager(org.osgi.framework.BundleContext ctx,
                         int maxLevel)
Create an OSGiLoggerManager.

Parameters:
ctx - the BundleContext used to get the LogService
maxLevel - the maximum log level (error is the lowest, debug the highest).
Method Detail

getLoggerForCategory

public Logger getLoggerForCategory(String category)
Specified by:
getLoggerForCategory in interface LoggerManager

getDefaultLogger

public Logger getDefaultLogger()
Specified by:
getDefaultLogger in interface LoggerManager


Copyright ? 1999-2005 The Apache Software Foundation. All Rights Reserved.