public class EventExample extends org.slf4j.helpers.MarkerIgnoringBase implements ReferenceInsertionEventHandler, MethodExceptionEventHandler, InvalidReferenceEventHandler
| Modifier and Type | Field and Description |
|---|---|
static int |
LOG_LEVEL_DEBUG |
static int |
LOG_LEVEL_ERROR |
static int |
LOG_LEVEL_INFO |
static int |
LOG_LEVEL_TRACE |
static int |
LOG_LEVEL_WARN |
protected String |
name |
| Constructor and Description |
|---|
EventExample() |
| Modifier and Type | Method and Description |
|---|---|
void |
debug(String msg) |
void |
debug(String format,
Object... argArray) |
void |
debug(String format,
Object param1) |
void |
debug(String format,
Object param1,
Object param2) |
void |
debug(String msg,
Throwable t) |
void |
error(String msg) |
void |
error(String format,
Object... argArray) |
void |
error(String format,
Object arg) |
void |
error(String format,
Object arg1,
Object arg2) |
void |
error(String msg,
Throwable t) |
void |
formatAndLog(int level,
String format,
Object... arguments)
This prints the level and formatted message to
System.out.
|
String |
getName()
Required init methods for Logger interface
|
void |
info(String msg) |
void |
info(String format,
Object... argArray) |
void |
info(String format,
Object arg) |
void |
info(String format,
Object arg1,
Object arg2) |
void |
info(String msg,
Throwable t) |
Object |
invalidGetMethod(Context context,
String reference,
Object object,
String property,
Info info)
Called when object is null or there is no getter for the given
property.
|
Object |
invalidMethod(Context context,
String reference,
Object object,
String method,
Info info)
Called when object is null or the given method does not exist.
|
boolean |
invalidSetMethod(Context context,
String leftreference,
String rightreference,
Info info)
Event handler for when the right hand side of
a #set() directive is null, which results in
a log message.
|
boolean |
isDebugEnabled() |
boolean |
isErrorEnabled() |
boolean |
isInfoEnabled() |
boolean |
isLevelEnabled(int level)
This always returns true because logging levels can't be disabled in
this impl.
|
boolean |
isTraceEnabled() |
boolean |
isWarnEnabled() |
void |
log(int level,
String message)
This just prints the message and level to System.out.
|
void |
log(int level,
String message,
Throwable t)
This prints the level, message, and the Throwable's message to
System.out.
|
static void |
main(String[] args) |
Object |
methodException(Context context,
Class claz,
String method,
Exception e,
Info info)
Called when a method throws an exception.
|
protected Object |
readResolve() |
Object |
referenceInsert(Context context,
String reference,
Object value)
Event handler for when a reference is inserted into the output stream.
|
void |
throwException()
silly method to throw an exception to demonstrate
the method invocation exception event handling
|
void |
trace(String msg) |
void |
trace(String format,
Object... argArray) |
void |
trace(String format,
Object param1) |
void |
trace(String format,
Object param1,
Object param2) |
void |
trace(String msg,
Throwable t) |
void |
warn(String msg) |
void |
warn(String format,
Object... argArray) |
void |
warn(String format,
Object arg) |
void |
warn(String format,
Object arg1,
Object arg2) |
void |
warn(String msg,
Throwable t) |
debug, debug, debug, debug, debug, error, error, error, error, error, info, info, info, info, info, isDebugEnabled, isErrorEnabled, isInfoEnabled, isTraceEnabled, isWarnEnabled, toString, trace, trace, trace, trace, trace, warn, warn, warn, warn, warnpublic static final int LOG_LEVEL_TRACE
public static final int LOG_LEVEL_DEBUG
public static final int LOG_LEVEL_INFO
public static final int LOG_LEVEL_WARN
public static final int LOG_LEVEL_ERROR
protected String name
public static void main(String[] args)
public void throwException()
throws Exception
Exceptionpublic Object referenceInsert(Context context, String reference, Object value)
referenceInsert in interface ReferenceInsertionEventHandlercontext - current contextreference - Reference from template about to be inserted.value - Value about to be inserted (after its toString()
method is called).toString() should be called for
output.public Object invalidGetMethod(Context context, String reference, Object object, String property, Info info)
InvalidReferenceEventHandlerinvalidGetMethod in interface InvalidReferenceEventHandlercontext - the context when the reference was found invalidreference - string with complete invalid referenceobject - the object referred to, or null if not foundproperty - the property name from the referenceinfo - contains template, line, column detailspublic Object invalidMethod(Context context, String reference, Object object, String method, Info info)
InvalidReferenceEventHandlerinvalidMethod in interface InvalidReferenceEventHandlercontext - the context when the reference was found invalidreference - string with complete invalid referenceobject - the object referred to, or null if not foundmethod - the name of the (non-existent) methodinfo - contains template, line, column detailspublic boolean invalidSetMethod(Context context, String leftreference, String rightreference, Info info)
invalidSetMethod in interface InvalidReferenceEventHandlercontext - the context when the reference was found invalidleftreference - left reference being assigned torightreference - invalid reference on the rightinfo - contains info on template, line, colpublic Object methodException(Context context, Class claz, String method, Exception e, Info info)
MethodExceptionEventHandlermethodException in interface MethodExceptionEventHandlercontext - current contextclaz - the class of the object the method is being applied tomethod - the methode - the thrown exceptioninfo - contains template, line, column detailspublic void log(int level,
String message)
public void log(int level,
String message,
Throwable t)
public void formatAndLog(int level,
String format,
Object... arguments)
public boolean isLevelEnabled(int level)
public String getName()
getName in interface org.slf4j.LoggergetName in class org.slf4j.helpers.MarkerIgnoringBasepublic boolean isTraceEnabled()
isTraceEnabled in interface org.slf4j.Loggerpublic void trace(String msg)
trace in interface org.slf4j.Loggerpublic void trace(String format, Object param1)
trace in interface org.slf4j.Loggerpublic void trace(String format, Object param1, Object param2)
trace in interface org.slf4j.Loggerpublic void trace(String format, Object... argArray)
trace in interface org.slf4j.Loggerpublic boolean isDebugEnabled()
isDebugEnabled in interface org.slf4j.Loggerpublic void debug(String msg)
debug in interface org.slf4j.Loggerpublic void debug(String format, Object param1)
debug in interface org.slf4j.Loggerpublic void debug(String format, Object param1, Object param2)
debug in interface org.slf4j.Loggerpublic void debug(String format, Object... argArray)
debug in interface org.slf4j.Loggerpublic boolean isInfoEnabled()
isInfoEnabled in interface org.slf4j.Loggerpublic void info(String msg)
info in interface org.slf4j.Loggerpublic void info(String format, Object arg1, Object arg2)
info in interface org.slf4j.Loggerpublic void info(String format, Object... argArray)
info in interface org.slf4j.Loggerpublic boolean isWarnEnabled()
isWarnEnabled in interface org.slf4j.Loggerpublic void warn(String msg)
warn in interface org.slf4j.Loggerpublic void warn(String format, Object arg1, Object arg2)
warn in interface org.slf4j.Loggerpublic void warn(String format, Object... argArray)
warn in interface org.slf4j.Loggerpublic boolean isErrorEnabled()
isErrorEnabled in interface org.slf4j.Loggerpublic void error(String msg)
error in interface org.slf4j.Loggerpublic void error(String format, Object arg)
error in interface org.slf4j.Loggerpublic void error(String format, Object arg1, Object arg2)
error in interface org.slf4j.Loggerpublic void error(String format, Object... argArray)
error in interface org.slf4j.Loggerprotected Object readResolve() throws ObjectStreamException
ObjectStreamExceptionCopyright © 2000–2021 The Apache Software Foundation. All rights reserved.