public final class SimpleULogger extends Object implements ULogger
System.out
).
The output includes the relative time in milliseconds, thread name, level, logger name, and the message followed by the line separator for the host. In log4j terms it amounts to the "%r [%t] %level %logger - %m%n" pattern.
176 [main] INFO examples.Sort - Populating an array of 2 elements in reverse. 225 [main] INFO examples.SortAlgo - Entered the sort method. 304 [main] INFO SortAlgo.DUMP - Dump of interger array: 317 [main] INFO SortAlgo.DUMP - Element [0] = 0 331 [main] INFO SortAlgo.DUMP - Element [1] = 1 343 [main] INFO examples.Sort - The next log statement should be an error msg. 346 [main] ERROR SortAlgo.DUMP - Tried to dump an uninitialized array. at org.log4j.examples.SortAlgo.dump(SortAlgo.java:58) at org.log4j.examples.Sort.main(Sort.java:64) 467 [main] INFO examples.Sort - Exiting main method.
Modifier and Type | Field and Description |
---|---|
static String |
LINE_SEPARATOR
Line separator.
|
Modifier and Type | Method and Description |
---|---|
void |
debug(Object msg)
Log a message object with the DEBUG level.
|
void |
debug(Object parameterizedMsg,
Object param1)
Log a parameterized message object at the DEBUG level.
|
void |
debug(Object msg,
Throwable t)
Log a message object with the
DEBUG level including the
stack trace of the Throwable t passed as parameter. |
void |
debug(String parameterizedMsg,
Object param1,
Object param2)
Log a parameterized message object at the DEBUG level.
|
void |
error(Object msg)
Log a message object with the ERROR level.
|
void |
error(Object parameterizedMsg,
Object param1)
Log a parameterized message object at the ERROR level.
|
void |
error(Object msg,
Throwable t)
Log a message object with the
ERROR level including the
stack trace of the Throwable t passed as parameter. |
void |
error(String parameterizedMsg,
Object param1,
Object param2)
Log a parameterized message object at the ERROR level.
|
static SimpleULogger |
getLogger(String name)
Creates a new instance.
|
void |
info(Object msg)
Log a message object with the INFO level.
|
void |
info(Object parameterizedMsg,
Object param1)
Log a parameterized message object at the INFO level.
|
void |
info(Object msg,
Throwable t)
Log a message object with the
INFO level including the
stack trace of the Throwable t passed as parameter. |
void |
info(String parameterizedMsg,
Object param1,
Object param2)
Log a parameterized message object at the INFO level.
|
boolean |
isDebugEnabled()
Is the logger instance enabled for the DEBUG level?
|
boolean |
isErrorEnabled()
Is the logger instance enabled for the ERROR level?
|
boolean |
isInfoEnabled()
Is the logger instance enabled for the INFO level?
|
boolean |
isWarnEnabled()
Is the logger instance enabled for the WARN level?
|
void |
warn(Object msg)
Log a message object with the WARN level.
|
void |
warn(Object parameterizedMsg,
Object param1)
Log a parameterized message object at the WARN level.
|
void |
warn(Object msg,
Throwable t)
Log a message object with the
WARN level including the
stack trace of the Throwable t passed as parameter. |
void |
warn(String parameterizedMsg,
Object param1,
Object param2)
Log a parameterized message object at the WARN level.
|
public static final String LINE_SEPARATOR
public static SimpleULogger getLogger(String name)
name
- logger namepublic boolean isDebugEnabled()
isDebugEnabled
in interface ULogger
public void debug(Object msg)
public void debug(Object parameterizedMsg, Object param1)
This form is useful in avoiding the superflous object creation problem when invoking this method while it is disabled.
public void debug(String parameterizedMsg, Object param1, Object param2)
This form is useful in avoiding the superflous object creation problem when invoking this method while it is disabled.
public void debug(Object msg, Throwable t)
DEBUG
level including the
stack trace of the Throwable
t
passed as parameter.public boolean isInfoEnabled()
isInfoEnabled
in interface ULogger
public void info(Object msg)
public void info(Object parameterizedMsg, Object param1)
This form is useful in avoiding the superflous object creation problem when invoking this method while it is disabled.
public void info(String parameterizedMsg, Object param1, Object param2)
This form is useful in avoiding the superflous object creation problem when invoking this method while it is disabled.
public void info(Object msg, Throwable t)
INFO
level including the
stack trace of the Throwable
t
passed as parameter.public boolean isWarnEnabled()
isWarnEnabled
in interface ULogger
public void warn(Object msg)
public void warn(Object parameterizedMsg, Object param1)
This form is useful in avoiding the superflous object creation problem when invoking this method while it is disabled.
public void warn(String parameterizedMsg, Object param1, Object param2)
This form is useful in avoiding the superflous object creation problem when invoking this method while it is disabled.
public void warn(Object msg, Throwable t)
WARN
level including the
stack trace of the Throwable
t
passed as parameter.public boolean isErrorEnabled()
isErrorEnabled
in interface ULogger
public void error(Object msg)
public void error(Object parameterizedMsg, Object param1)
This form is useful in avoiding the superflous object creation problem when invoking this method while it is disabled.
public void error(String parameterizedMsg, Object param1, Object param2)
This form is useful in avoiding the superflous object creation problem when invoking this method while it is disabled.
Copyright © 2002-2017 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache Chainsaw, Chainsaw, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.