public class SystemOutLoggingTool extends Object implements ILoggingTool
ILoggingTool
interface that sends output to
the System.err
channel.DEBUG, DEFAULT_STACK_LENGTH, ERROR, FATAL, INFO, TRACE, WARN
Constructor and Description |
---|
SystemOutLoggingTool(Class<?> classInst)
Constructs a ILoggingTool which produces log lines indicating them to be
for the given Class.
|
Modifier and Type | Method and Description |
---|---|
static ILoggingTool |
create(Class<?> sourceClass)
Creates a new
SystemOutLoggingTool for the given class. |
void |
debug(Object object)
Shows DEBUG output for the Object.
|
void |
debug(Object object,
Object... objects)
Shows DEBUG output for the given Object's.
|
void |
dumpClasspath()
Outputs the system property for java.class.path.
|
void |
dumpSystemProperties()
Outputs system properties for the operating system and the java
version.
|
void |
error(Object object)
Shows ERROR output for the Object.
|
void |
error(Object object,
Object... objects)
Shows ERROR output for the given Object's.
|
void |
fatal(Object object)
Shows FATAL output for the Object.
|
int |
getLevel()
Get the current level of this logger.
|
void |
info(Object object)
Shows INFO output for the Object.
|
void |
info(Object object,
Object... objects)
Shows INFO output for the given Object's.
|
boolean |
isDebugEnabled()
Use this method for computational demanding debug info.
|
protected void |
setDebugEnabled(boolean enabled)
Deprecated.
use
setLevel(int) |
void |
setLevel(int level)
Set the level of this logger.
|
void |
setStackLength(int length)
Sets the number of StackTraceElements to be printed in DEBUG mode when
calling
debug(Throwable) . |
void |
warn(Object object)
Shows WARN output for the Object.
|
void |
warn(Object object,
Object... objects)
Shows WARN output for the given Object's.
|
public SystemOutLoggingTool(Class<?> classInst)
classInst
- Class from which the log messages originatepublic void dumpSystemProperties()
dumpSystemProperties
in interface ILoggingTool
public void setStackLength(int length)
debug(Throwable)
.
The default value is DEFAULT_STACK_LENGTH.setStackLength
in interface ILoggingTool
length
- the new stack lengthILoggingTool.DEFAULT_STACK_LENGTH
public void dumpClasspath()
dumpClasspath
in interface ILoggingTool
public void debug(Object object)
Throwable
it will output the trace. Otherwise it will use the
toString() method.debug
in interface ILoggingTool
object
- Object to apply toString() too and outputpublic void debug(Object object, Object... objects)
debug
in interface ILoggingTool
object
- Object to apply toString() too and outputobjects
- Object... to apply toString() too and outputpublic void error(Object object)
error
in interface ILoggingTool
object
- Object to apply toString() too and outputpublic void error(Object object, Object... objects)
error
in interface ILoggingTool
object
- Object to apply toString() too and outputobjects
- Object... to apply toString() too and outputpublic void fatal(Object object)
fatal
in interface ILoggingTool
object
- Object to apply toString() too and outputpublic void info(Object object)
info
in interface ILoggingTool
object
- Object to apply toString() too and outputpublic void info(Object object, Object... objects)
info
in interface ILoggingTool
object
- Object to apply toString() too and outputobjects
- Object... to apply toString() too and outputpublic void warn(Object object)
warn
in interface ILoggingTool
object
- Object to apply toString() too and outputpublic void warn(Object object, Object... objects)
warn
in interface ILoggingTool
object
- Object to apply toString() too and outputobjects
- Object... to apply toString() too and outputpublic boolean isDebugEnabled()
if (logger.isDebugEnabled()) { logger.info("The 1056389822th prime that is used is: ", calculatePrime(1056389822)); }
isDebugEnabled
in interface ILoggingTool
public static ILoggingTool create(Class<?> sourceClass)
SystemOutLoggingTool
for the given class.sourceClass
- Class for which logging messages are recorded.SystemOutLoggingTool
.@Deprecated protected void setDebugEnabled(boolean enabled)
setLevel(int)
public void setLevel(int level)
ILoggingTool.TRACE
, ILoggingTool.DEBUG
, ILoggingTool.INFO
, ILoggingTool.WARN
, ILoggingTool.ERROR
, ILoggingTool.FATAL
. After setting the level only messages
above the specified level will be emitted.setLevel
in interface ILoggingTool
level
- the levelpublic int getLevel()
ILoggingTool.TRACE
, ILoggingTool.DEBUG
, ILoggingTool.INFO
, ILoggingTool.WARN
, ILoggingTool.ERROR
, ILoggingTool.FATAL
.getLevel
in interface ILoggingTool
Copyright © 2021. All rights reserved.