Package org.jboss.logging

# Class Slf4jLoggerProvider

java.lang.Object
org.jboss.logging.Slf4jLoggerProvider

All Implemented Interfaces:
  `LoggerProvider`

public final class Slf4jLoggerProvider extends 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

Modifier and Type
Method
Description
`void`
`clearMdc()`
Removes all entries from the message diagnostics context.
`void`
`clearNdc()`
`Logger`
`getLogger(String name)`
Returns a logger which is backed by a logger from the log provider.
`Object`
`getMdc(String key)`
Returns the value for the key on the message diagnostics context or `null` if no value was found.
`Map<String,Object>`
`getMdcMap()`
Returns the map from the context.
`String`
`getNdc()`
`int`
`getNdcDepth()`
`String`
`peekNdc()`
`String`
`popNdc()`
`void`
`pushNdc(String message)`
`Object`
`putMdc(String key, Object value)`
Puts the value onto the message diagnostics context.
`void`
`removeMdc(String key)`
Removes the value from the message diagnostics context.
`void`
`setNdcMaxDepth(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`

## Constructor Details

### Slf4jLoggerProvider

public Slf4jLoggerProvider()

## Method Details

### getLogger

public Logger getLogger(String name)
Description copied from interface: `LoggerProvider`
Returns a logger which is backed by a logger from the log provider.

Note: this should never be `null`

Specified by:
  `getLogger` in interface `LoggerProvider`
Parameters:
  `name` - the name of the logger
Returns:
  a logger for the log provider logger.

### clearMdc

public void clearMdc()
Description copied from interface: `LoggerProvider`
Removes all entries from the message diagnostics context.

Specified by:
  `clearMdc` in interface `LoggerProvider`

### putMdc

public Object putMdc(String key, Object value)
Description copied from interface: `LoggerProvider`
Puts the value onto the message diagnostics context.

Specified by:
  `putMdc` in interface `LoggerProvider`
Parameters:
  `key` - the key for the value
  `value` - the value
Returns:
  the previous value set or `null` if no value was set

### getMdc

public Object getMdc(String key)
Description copied from interface: `LoggerProvider`
Returns the value for the key on the message diagnostics context or `null` if no value was found.

Specified by:
  `getMdc` in interface `LoggerProvider`
Parameters:
  `key` - the key to lookup the value for
Returns:
  the value or `null` if not found

### removeMdc

public void removeMdc(String key)
Description copied from interface: `LoggerProvider`
Removes the value from the message diagnostics context.

Specified by:
  `removeMdc` in interface `LoggerProvider`
Parameters:
  `key` - the key of the value to remove

### getMdcMap

public Map<String,Object> getMdcMap()
Description copied from interface: `LoggerProvider`
Returns the map from the context.

Note that in most implementations this is an expensive operation and should be used sparingly.

Specified by:
  `getMdcMap` in interface `LoggerProvider`
Returns:
  the map from the context or an empty map if the context is `null`

### clearNdc

public void clearNdc()

### getNdc

public String getNdc()

### getNdcDepth

public int getNdcDepth()

### peekNdc

public String peekNdc()

### popNdc

public String popNdc()

### pushNdc

public void pushNdc(String message)

### setNdcMaxDepth

public void setNdcMaxDepth(int maxDepth)