Package org.springframework.core.log

# Class LogAccessor

java.lang.Object
org.springframework.core.log.LogAccessor

public class LogAccessor extends Object
A convenient accessor for Commons Logging, providing not only `CharSequence` based log methods but also `Supplier` based variants for use with Java 8 lambda expressions.

Since:
  5.2
Author:
  Juergen Hoeller

## Constructor Summary

Constructors
Constructor
Description
`LogAccessor(Class<?> logCategory)`
Create a new accessor for the specified Commons Log category.
`LogAccessor(String logCategory)`
Create a new accessor for the specified Commons Log category.
`LogAccessor(org.apache.commons.logging.Log log)`
Create a new accessor for the given Commons Log.

## Method Summary

Modifier and Type
Method
Description
`void`
`debug(CharSequence message)`
Log a message with debug log level.
`void`
`debug(Throwable cause, CharSequence message)`
Log an error with debug log level.
`void`
`debug(Throwable cause, Supplier<? extends CharSequence> messageSupplier)`
Log an error with debug log level.
`void`
`debug(Supplier<? extends CharSequence> messageSupplier)`
Log a message with debug log level.
`void`
`error(CharSequence message)`
Log a message with error log level.
`void`
`error(Throwable cause, CharSequence message)`
Log an error with error log level.
`void`
`error(Throwable cause, Supplier<? extends CharSequence> messageSupplier)`
Log an error with error log level.
`void`
`error(Supplier<? extends CharSequence> messageSupplier)`
Log a message with error log level.
`void`
`fatal(CharSequence message)`
Log a message with fatal log level.
`void`
`fatal(Throwable cause, CharSequence message)`
Log an error with fatal log level.
`void`
`fatal(Throwable cause, Supplier<? extends CharSequence> messageSupplier)`
Log an error with fatal log level.
`void`
`fatal(Supplier<? extends CharSequence> messageSupplier)`
Log a message with fatal log level.
`final org.apache.commons.logging.Log`
`getLog()`
Return the target Commons Log.
`void`
`info(CharSequence message)`
Log a message with info log level.
`void`
`info(Throwable cause, CharSequence message)`
Log an error with info log level.
`void`
`info(Throwable cause, Supplier<? extends CharSequence> messageSupplier)`
Log an error with info log level.
`void`
`info(Supplier<? extends CharSequence> messageSupplier)`
Log a message with info log level.
`boolean`
`isDebugEnabled()`
Is debug logging currently enabled?
`boolean`
`isErrorEnabled()`
Is error logging currently enabled?
`boolean`
`isFatalEnabled()`
Is fatal logging currently enabled?
`boolean`
`isInfoEnabled()`
Is info logging currently enabled?
`boolean`
`isTraceEnabled()`
Is trace logging currently enabled?
`boolean`
`isWarnEnabled()`
Is warn logging currently enabled?
`void`
`trace(CharSequence message)`
Log a message with trace log level.
`void`
`trace(Throwable cause, CharSequence message)`
Log an error with trace log level.
`void`
`trace(Throwable cause, Supplier<? extends CharSequence> messageSupplier)`
Log an error with trace log level.
`void`
`trace(Supplier<? extends CharSequence> messageSupplier)`
Log a message with trace log level.
`void`
`warn(CharSequence message)`
Log a message with warn log level.
`void`
`warn(Throwable cause, CharSequence message)`
Log an error with warn log level.
`void`
`warn(Throwable cause, Supplier<? extends CharSequence> messageSupplier)`
Log an error with warn log level.
`void`
`warn(Supplier<? extends CharSequence> messageSupplier)`
Log a message with warn log level.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### LogAccessor

public LogAccessor(org.apache.commons.logging.Log log)
Create a new accessor for the given Commons Log.

See Also:
  - `LogFactory.getLog(Class)`
  - `LogFactory.getLog(String)`

### LogAccessor

public LogAccessor(Class<?> logCategory)
Create a new accessor for the specified Commons Log category.

See Also:
  - `LogFactory.getLog(Class)`

### LogAccessor

public LogAccessor(String logCategory)
Create a new accessor for the specified Commons Log category.

See Also:
  - `LogFactory.getLog(String)`

## Method Details

### getLog

public final org.apache.commons.logging.Log getLog()
Return the target Commons Log.

### isFatalEnabled

public boolean isFatalEnabled()
Is fatal logging currently enabled?

### isErrorEnabled

public boolean isErrorEnabled()
Is error logging currently enabled?

### isWarnEnabled

public boolean isWarnEnabled()
Is warn logging currently enabled?

### isInfoEnabled

public boolean isInfoEnabled()
Is info logging currently enabled?

### isDebugEnabled

public boolean isDebugEnabled()
Is debug logging currently enabled?

### isTraceEnabled

public boolean isTraceEnabled()
Is trace logging currently enabled?

### fatal

public void fatal(CharSequence message)
Log a message with fatal log level.

Parameters:
  `message` - the message to log

### fatal

public void fatal(Throwable cause, CharSequence message)
Log an error with fatal log level.

Parameters:
  `cause` - the exception to log
  `message` - the message to log

### error

public void error(CharSequence message)
Log a message with error log level.

Parameters:
  `message` - the message to log

### error

public void error(Throwable cause, CharSequence message)
Log an error with error log level.

Parameters:
  `cause` - the exception to log
  `message` - the message to log

### warn

public void warn(CharSequence message)
Log a message with warn log level.

Parameters:
  `message` - the message to log

### warn

public void warn(Throwable cause, CharSequence message)
Log an error with warn log level.

Parameters:
  `cause` - the exception to log
  `message` - the message to log

### info

public void info(CharSequence message)
Log a message with info log level.

Parameters:
  `message` - the message to log

### info

public void info(Throwable cause, CharSequence message)
Log an error with info log level.

Parameters:
  `cause` - the exception to log
  `message` - the message to log

### debug

public void debug(CharSequence message)
Log a message with debug log level.

Parameters:
  `message` - the message to log

### debug

public void debug(Throwable cause, CharSequence message)
Log an error with debug log level.

Parameters:
  `cause` - the exception to log
  `message` - the message to log

### trace

public void trace(CharSequence message)
Log a message with trace log level.

Parameters:
  `message` - the message to log

### trace

public void trace(Throwable cause, CharSequence message)
Log an error with trace log level.

Parameters:
  `cause` - the exception to log
  `message` - the message to log

### fatal

public void fatal(Supplier<? extends CharSequence> messageSupplier)
Log a message with fatal log level.

Parameters:
  `messageSupplier` - a lazy supplier for the message to log

### fatal

public void fatal(Throwable cause, Supplier<? extends CharSequence> messageSupplier)
Log an error with fatal log level.

Parameters:
  `cause` - the exception to log
  `messageSupplier` - a lazy supplier for the message to log

### error

public void error(Supplier<? extends CharSequence> messageSupplier)
Log a message with error log level.

Parameters:
  `messageSupplier` - a lazy supplier for the message to log

### error

public void error(Throwable cause, Supplier<? extends CharSequence> messageSupplier)
Log an error with error log level.

Parameters:
  `cause` - the exception to log
  `messageSupplier` - a lazy supplier for the message to log

### warn

public void warn(Supplier<? extends CharSequence> messageSupplier)
Log a message with warn log level.

Parameters:
  `messageSupplier` - a lazy supplier for the message to log

### warn

public void warn(Throwable cause, Supplier<? extends CharSequence> messageSupplier)
Log an error with warn log level.

Parameters:
  `cause` - the exception to log
  `messageSupplier` - a lazy supplier for the message to log

### info

public void info(Supplier<? extends CharSequence> messageSupplier)
Log a message with info log level.

Parameters:
  `messageSupplier` - a lazy supplier for the message to log

### info

public void info(Throwable cause, Supplier<? extends CharSequence> messageSupplier)
Log an error with info log level.

Parameters:
  `cause` - the exception to log
  `messageSupplier` - a lazy supplier for the message to log

### debug

public void debug(Supplier<? extends CharSequence> messageSupplier)
Log a message with debug log level.

Parameters:
  `messageSupplier` - a lazy supplier for the message to log

### debug

public void debug(Throwable cause, Supplier<? extends CharSequence> messageSupplier)
Log an error with debug log level.

Parameters:
  `cause` - the exception to log
  `messageSupplier` - a lazy supplier for the message to log

### trace

public void trace(Supplier<? extends CharSequence> messageSupplier)
Log a message with trace log level.

Parameters:
  `messageSupplier` - a lazy supplier for the message to log

### trace

public void trace(Throwable cause, Supplier<? extends CharSequence> messageSupplier)
Log an error with trace log level.

Parameters:
  `cause` - the exception to log
  `messageSupplier` - a lazy supplier for the message to log