Package org.apache.felix.scr.impl.logger
Class NoOpLogger
- java.lang.Object
-
- org.apache.felix.scr.impl.logger.NoOpLogger
-
- All Implemented Interfaces:
BundleLogger
,ComponentLogger
,InternalLogger
,ScrLogger
public class NoOpLogger extends java.lang.Object implements ScrLogger, BundleLogger, ComponentLogger
This is a dummy logger which is only used when the logging is not enabled at all.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.felix.scr.impl.logger.InternalLogger
InternalLogger.Level
-
-
Constructor Summary
Constructors Constructor Description NoOpLogger()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BundleLogger
bundle(org.osgi.framework.Bundle bundle)
Create a bundle loggervoid
close()
Close the log managerComponentLogger
component(org.osgi.framework.Bundle bundle, java.lang.String implementationClassName, java.lang.String name)
boolean
isLogEnabled(InternalLogger.Level level)
Answer true if the current logging level is enabled for the given level.void
log(InternalLogger.Level level, java.lang.String message, java.lang.Throwable ex)
Logs the message to an appropriate OSGi logger.void
log(InternalLogger.Level level, java.lang.String message, java.lang.Throwable ex, java.lang.Object... args)
Formats the message using theMessageFormat
class, i.e.void
setComponentId(long componentId)
-
-
-
Method Detail
-
log
public void log(InternalLogger.Level level, java.lang.String message, java.lang.Throwable ex)
Description copied from interface:InternalLogger
Logs the message to an appropriate OSGi logger. If not such logger can be found then it will log to stderr for ERROR & AUDIT messages and stdout for other messages- Specified by:
log
in interfaceInternalLogger
- Parameters:
level
- only log when this level is implied by the current log levelmessage
- the message to logex
- a Throwable or null
-
log
public void log(InternalLogger.Level level, java.lang.String message, java.lang.Throwable ex, java.lang.Object... args)
Description copied from interface:InternalLogger
Formats the message using theMessageFormat
class, i.e. with {} place holders for the args. It then callsInternalLogger.log(Level, String, Throwable)
.- Specified by:
log
in interfaceInternalLogger
- Parameters:
level
- only log when this level is implied by the current log levelmessage
- the message to logex
- a Throwable or nullargs
- the arguments to theMessageFormat
formatting
-
isLogEnabled
public boolean isLogEnabled(InternalLogger.Level level)
Description copied from interface:InternalLogger
Answer true if the current logging level is enabled for the given level. For stdout/stderr fallback the logging level is defined by theLogConfiguration.getLogLevel()
. If there is an OSGi logger available then the logger name will define the log level viaLoggerAdmin
.- Specified by:
isLogEnabled
in interfaceInternalLogger
- Parameters:
level
- the level to check- Returns:
- true if the given log level is enabled
-
setComponentId
public void setComponentId(long componentId)
- Specified by:
setComponentId
in interfaceComponentLogger
-
component
public ComponentLogger component(org.osgi.framework.Bundle bundle, java.lang.String implementationClassName, java.lang.String name)
- Specified by:
component
in interfaceBundleLogger
-
bundle
public BundleLogger bundle(org.osgi.framework.Bundle bundle)
Description copied from interface:ScrLogger
Create a bundle logger
-
-