Package org.jboss.logging
Class Slf4jLoggerProvider
- java.lang.Object
-
- org.jboss.logging.Slf4jLoggerProvider
-
- All Implemented Interfaces:
LoggerProvider
public final class Slf4jLoggerProvider extends java.lang.Object implements LoggerProvider
An implementation of the log provider for slf4j with Logback as the log manager.
-
-
Constructor Summary
Constructors Constructor Description Slf4jLoggerProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearMdc()Removes all entries from the message diagnostics context.voidclearNdc()LoggergetLogger(java.lang.String name)Returns a logger which is backed by a logger from the log provider.java.lang.ObjectgetMdc(java.lang.String key)Returns the value for the key on the message diagnostics context ornullif no value was found.java.util.Map<java.lang.String,java.lang.Object>getMdcMap()Returns the map from the context.java.lang.StringgetNdc()intgetNdcDepth()java.lang.StringpeekNdc()java.lang.StringpopNdc()voidpushNdc(java.lang.String message)java.lang.ObjectputMdc(java.lang.String key, java.lang.Object value)Puts the value onto the message diagnostics context.voidremoveMdc(java.lang.String key)Removes the value from the message diagnostics context.voidsetNdcMaxDepth(int maxDepth)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jboss.logging.LoggerProvider
clearNdc, getNdc, getNdcDepth, peekNdc, popNdc, pushNdc, setNdcMaxDepth
-
-
-
-
Method Detail
-
getLogger
public Logger getLogger(java.lang.String name)
Description copied from interface:LoggerProviderReturns a logger which is backed by a logger from the log provider.Note: this should never be
null- Specified by:
getLoggerin interfaceLoggerProvider- Parameters:
name- the name of the logger- Returns:
- a logger for the log provider logger.
-
clearMdc
public void clearMdc()
Description copied from interface:LoggerProviderRemoves all entries from the message diagnostics context.- Specified by:
clearMdcin interfaceLoggerProvider
-
putMdc
public java.lang.Object putMdc(java.lang.String key, java.lang.Object value)Description copied from interface:LoggerProviderPuts the value onto the message diagnostics context.- Specified by:
putMdcin interfaceLoggerProvider- Parameters:
key- the key for the valuevalue- the value- Returns:
- the previous value set or
nullif no value was set
-
getMdc
public java.lang.Object getMdc(java.lang.String key)
Description copied from interface:LoggerProviderReturns the value for the key on the message diagnostics context ornullif no value was found.- Specified by:
getMdcin interfaceLoggerProvider- Parameters:
key- the key to lookup the value for- Returns:
- the value or
nullif not found
-
removeMdc
public void removeMdc(java.lang.String key)
Description copied from interface:LoggerProviderRemoves the value from the message diagnostics context.- Specified by:
removeMdcin interfaceLoggerProvider- Parameters:
key- the key of the value to remove
-
getMdcMap
public java.util.Map<java.lang.String,java.lang.Object> getMdcMap()
Description copied from interface:LoggerProviderReturns the map from the context.Note that in most implementations this is an expensive operation and should be used sparingly.
- Specified by:
getMdcMapin interfaceLoggerProvider- Returns:
- the map from the context or an empty map if the context is
null
-
clearNdc
public void clearNdc()
-
getNdc
public java.lang.String getNdc()
-
getNdcDepth
public int getNdcDepth()
-
peekNdc
public java.lang.String peekNdc()
-
popNdc
public java.lang.String popNdc()
-
pushNdc
public void pushNdc(java.lang.String message)
-
setNdcMaxDepth
public void setNdcMaxDepth(int maxDepth)
-
-