Top Description Fields Constructors Methods
org.springframework.core.log

public Class LogAccessor

extends Object
Class Inheritance
Imports
java.util.function.Supplier, org.apache.commons.logging.Log, .LogFactory

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.
Author
Juergen Hoeller
Since
5.2

Field Summary

Modifier and TypeField and Description
private final Log

Constructor Summary

AccessConstructor and Description
public
LogAccessor(Log log)

Create a new accessor for the given Commons Log.

public
LogAccessor(Class<?> logCategory)

Create a new accessor for the specified Commons Log category.

public
LogAccessor(String logCategory)

Create a new accessor for the specified Commons Log category.

Method Summary

Modifier and TypeMethod and Description
public void
debug(CharSequence
the message to log
message
)

Log a message with debug log level.

public void
debug(Throwable
the exception to log
cause
,
CharSequence
the message to log
message
)

Log an error with debug log level.

public void
debug(Supplier<? extends CharSequence>
a lazy supplier for the message to log
messageSupplier
)

Log a message with debug log level.

public void
debug(Throwable
the exception to log
cause
,
Supplier<? extends CharSequence>
a lazy supplier for the message to log
messageSupplier
)

Log an error with debug log level.

public void
error(CharSequence
the message to log
message
)

Log a message with error log level.

public void
error(Throwable
the exception to log
cause
,
CharSequence
the message to log
message
)

Log an error with error log level.

public void
error(Supplier<? extends CharSequence>
a lazy supplier for the message to log
messageSupplier
)

Log a message with error log level.

public void
error(Throwable
the exception to log
cause
,
Supplier<? extends CharSequence>
a lazy supplier for the message to log
messageSupplier
)

Log an error with error log level.

public void
fatal(CharSequence
the message to log
message
)

Log a message with fatal log level.

public void
fatal(Throwable
the exception to log
cause
,
CharSequence
the message to log
message
)

Log an error with fatal log level.

public void
fatal(Supplier<? extends CharSequence>
a lazy supplier for the message to log
messageSupplier
)

Log a message with fatal log level.

public void
fatal(Throwable
the exception to log
cause
,
Supplier<? extends CharSequence>
a lazy supplier for the message to log
messageSupplier
)

Log an error with fatal log level.

public final Log
getLog()

Return the target Commons Log.

public void
info(CharSequence
the message to log
message
)

Log a message with info log level.

public void
info(Throwable
the exception to log
cause
,
CharSequence
the message to log
message
)

Log an error with info log level.

public void
info(Supplier<? extends CharSequence>
a lazy supplier for the message to log
messageSupplier
)

Log a message with info log level.

public void
info(Throwable
the exception to log
cause
,
Supplier<? extends CharSequence>
a lazy supplier for the message to log
messageSupplier
)

Log an error with info log level.

public boolean
isDebugEnabled()

Is debug logging currently enabled?

public boolean
isErrorEnabled()

Is error logging currently enabled?

public boolean
isFatalEnabled()

Is fatal logging currently enabled?

public boolean
isInfoEnabled()

Is info logging currently enabled?

public boolean
isTraceEnabled()

Is trace logging currently enabled?

public boolean
isWarnEnabled()

Is warn logging currently enabled?

public void
trace(CharSequence
the message to log
message
)

Log a message with trace log level.

public void
trace(Throwable
the exception to log
cause
,
CharSequence
the message to log
message
)

Log an error with trace log level.

public void
trace(Supplier<? extends CharSequence>
a lazy supplier for the message to log
messageSupplier
)

Log a message with trace log level.

public void
trace(Throwable
the exception to log
cause
,
Supplier<? extends CharSequence>
a lazy supplier for the message to log
messageSupplier
)

Log an error with trace log level.

public void
warn(CharSequence
the message to log
message
)

Log a message with warn log level.

public void
warn(Throwable
the exception to log
cause
,
CharSequence
the message to log
message
)

Log an error with warn log level.

public void
warn(Supplier<? extends CharSequence>
a lazy supplier for the message to log
messageSupplier
)

Log a message with warn log level.

public void
warn(Throwable
the exception to log
cause
,
Supplier<? extends CharSequence>
a lazy supplier for the message to log
messageSupplier
)

Log an error with warn log level.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

logback to summary
private final Log log

Constructor Detail

LogAccessorback to summary
public LogAccessor(Log log)

Create a new accessor for the given Commons Log.

See Also
LogFactory#getLog(Class), LogFactory#getLog(String)
LogAccessorback to summary
public LogAccessor(Class<?> logCategory)

Create a new accessor for the specified Commons Log category.

See Also
LogFactory#getLog(Class)
LogAccessorback to summary
public LogAccessor(String logCategory)

Create a new accessor for the specified Commons Log category.

See Also
LogFactory#getLog(String)

Method Detail

debugback to summary
public void debug(CharSequence message)

Log a message with debug log level.

Parameters
message:CharSequence

the message to log

debugback to summary
public void debug(Throwable cause, CharSequence message)

Log an error with debug log level.

Parameters
cause:Throwable

the exception to log

message:CharSequence

the message to log

debugback to summary
public void debug(Supplier<? extends CharSequence> messageSupplier)

Log a message with debug log level.

Parameters
messageSupplier:Supplier<? extends CharSequence>

a lazy supplier for the message to log

debugback to summary
public void debug(Throwable cause, Supplier<? extends CharSequence> messageSupplier)

Log an error with debug log level.

Parameters
cause:Throwable

the exception to log

messageSupplier:Supplier<? extends CharSequence>

a lazy supplier for the message to log

errorback to summary
public void error(CharSequence message)

Log a message with error log level.

Parameters
message:CharSequence

the message to log

errorback to summary
public void error(Throwable cause, CharSequence message)

Log an error with error log level.

Parameters
cause:Throwable

the exception to log

message:CharSequence

the message to log

errorback to summary
public void error(Supplier<? extends CharSequence> messageSupplier)

Log a message with error log level.

Parameters
messageSupplier:Supplier<? extends CharSequence>

a lazy supplier for the message to log

errorback to summary
public void error(Throwable cause, Supplier<? extends CharSequence> messageSupplier)

Log an error with error log level.

Parameters
cause:Throwable

the exception to log

messageSupplier:Supplier<? extends CharSequence>

a lazy supplier for the message to log

fatalback to summary
public void fatal(CharSequence message)

Log a message with fatal log level.

Parameters
message:CharSequence

the message to log

fatalback to summary
public void fatal(Throwable cause, CharSequence message)

Log an error with fatal log level.

Parameters
cause:Throwable

the exception to log

message:CharSequence

the message to log

fatalback to summary
public void fatal(Supplier<? extends CharSequence> messageSupplier)

Log a message with fatal log level.

Parameters
messageSupplier:Supplier<? extends CharSequence>

a lazy supplier for the message to log

fatalback to summary
public void fatal(Throwable cause, Supplier<? extends CharSequence> messageSupplier)

Log an error with fatal log level.

Parameters
cause:Throwable

the exception to log

messageSupplier:Supplier<? extends CharSequence>

a lazy supplier for the message to log

getLogback to summary
public final Log getLog()

Return the target Commons Log.

infoback to summary
public void info(CharSequence message)

Log a message with info log level.

Parameters
message:CharSequence

the message to log

infoback to summary
public void info(Throwable cause, CharSequence message)

Log an error with info log level.

Parameters
cause:Throwable

the exception to log

message:CharSequence

the message to log

infoback to summary
public void info(Supplier<? extends CharSequence> messageSupplier)

Log a message with info log level.

Parameters
messageSupplier:Supplier<? extends CharSequence>

a lazy supplier for the message to log

infoback to summary
public void info(Throwable cause, Supplier<? extends CharSequence> messageSupplier)

Log an error with info log level.

Parameters
cause:Throwable

the exception to log

messageSupplier:Supplier<? extends CharSequence>

a lazy supplier for the message to log

isDebugEnabledback to summary
public boolean isDebugEnabled()

Is debug logging currently enabled?

isErrorEnabledback to summary
public boolean isErrorEnabled()

Is error logging currently enabled?

isFatalEnabledback to summary
public boolean isFatalEnabled()

Is fatal logging currently enabled?

isInfoEnabledback to summary
public boolean isInfoEnabled()

Is info logging currently enabled?

isTraceEnabledback to summary
public boolean isTraceEnabled()

Is trace logging currently enabled?

isWarnEnabledback to summary
public boolean isWarnEnabled()

Is warn logging currently enabled?

traceback to summary
public void trace(CharSequence message)

Log a message with trace log level.

Parameters
message:CharSequence

the message to log

traceback to summary
public void trace(Throwable cause, CharSequence message)

Log an error with trace log level.

Parameters
cause:Throwable

the exception to log

message:CharSequence

the message to log

traceback to summary
public void trace(Supplier<? extends CharSequence> messageSupplier)

Log a message with trace log level.

Parameters
messageSupplier:Supplier<? extends CharSequence>

a lazy supplier for the message to log

traceback to summary
public void trace(Throwable cause, Supplier<? extends CharSequence> messageSupplier)

Log an error with trace log level.

Parameters
cause:Throwable

the exception to log

messageSupplier:Supplier<? extends CharSequence>

a lazy supplier for the message to log

warnback to summary
public void warn(CharSequence message)

Log a message with warn log level.

Parameters
message:CharSequence

the message to log

warnback to summary
public void warn(Throwable cause, CharSequence message)

Log an error with warn log level.

Parameters
cause:Throwable

the exception to log

message:CharSequence

the message to log

warnback to summary
public void warn(Supplier<? extends CharSequence> messageSupplier)

Log a message with warn log level.

Parameters
messageSupplier:Supplier<? extends CharSequence>

a lazy supplier for the message to log

warnback to summary
public void warn(Throwable cause, Supplier<? extends CharSequence> messageSupplier)

Log an error with warn log level.

Parameters
cause:Throwable

the exception to log

messageSupplier:Supplier<? extends CharSequence>

a lazy supplier for the message to log