Package org.jboss.logging
Interface LoggerProvider
- All Known Implementing Classes:
JBossLogManagerProvider,JDKLoggerProvider,Log4j2LoggerProvider,Log4jLoggerProvider,Slf4jLoggerProvider
public interface LoggerProvider
A contract for the log provider implementation.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclearMdc()Removes all entries from the message diagnostics context.voidclearNdc()Clears the nested diagnostics context.Returns a logger which is backed by a logger from the log provider.Returns the value for the key on the message diagnostics context ornullif no value was found.Returns the map from the context.getNdc()Retrieves the current values set for the nested diagnostics context.intThe current depth of the nested diagnostics context.peekNdc()Peeks at the top value from the stack and returns it.popNdc()Pops top value from the stack and returns it.voidPushes a value to the nested diagnostics context stack.Puts the value onto the message diagnostics context.voidRemoves the value from the message diagnostics context.voidsetNdcMaxDepth(int maxDepth) Sets maximum depth of the stack removing any entries below the maximum depth.
-
Method Details
-
getLogger
Returns a logger which is backed by a logger from the log provider.Note: this should never be
null- Parameters:
name- the name of the logger- Returns:
- a logger for the log provider logger.
-
clearMdc
void clearMdc()Removes all entries from the message diagnostics context. -
putMdc
Puts the value onto the message diagnostics context.- Parameters:
key- the key for the valuevalue- the value- Returns:
- the previous value set or
nullif no value was set
-
getMdc
Returns the value for the key on the message diagnostics context ornullif no value was found.- Parameters:
key- the key to lookup the value for- Returns:
- the value or
nullif not found
-
removeMdc
Removes the value from the message diagnostics context.- Parameters:
key- the key of the value to remove
-
getMdcMap
Returns the map from the context.Note that in most implementations this is an expensive operation and should be used sparingly.
- Returns:
- the map from the context or an empty map if the context is
null
-
clearNdc
void clearNdc()Clears the nested diagnostics context. -
getNdc
String getNdc()Retrieves the current values set for the nested diagnostics context.- Returns:
- the current value set or
nullif no value was set
-
getNdcDepth
int getNdcDepth()The current depth of the nested diagnostics context.- Returns:
- the current depth of the stack
-
popNdc
String popNdc()Pops top value from the stack and returns it.- Returns:
- the top value from the stack or an empty string if no value was set
-
peekNdc
String peekNdc()Peeks at the top value from the stack and returns it.- Returns:
- the value or an empty string
-
pushNdc
Pushes a value to the nested diagnostics context stack.- Parameters:
message- the message to push
-
setNdcMaxDepth
void setNdcMaxDepth(int maxDepth) Sets maximum depth of the stack removing any entries below the maximum depth.- Parameters:
maxDepth- the maximum depth to set
-