Class TestSplitLogger
java.lang.Object
org.jlab.logging.TestSplitLogger
A simple class demonstrating how to use
SplitLogger
.
The SplitLogger
class will send SEVERE
and WARNING
log messages
to stderr
, and all lower levels to stdout
.
How to set the logging level:
A .properties
file is necessary, which has the class name and desired log level; for example,
org.jlab.logging.TestSplitLogger.level = FINEFrom high to low, the levels are:
SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST
.
There are some example .properties
files you can use with this class, like so:
java \ -Djava.util.logging.config.file=common-tools/clas-logging/src/main/resources/org/jlab/logging/TestSplitLogger.finest.properties \ -cp ... \ org.jlab.logging.TestSplitLoggerYou may write your own
.properties
file, to control the logging level of all classes which use logging.- Author:
- dilks
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionconstructor: prints some messages tostdout
, but not using the logger yet -
Method Summary
Modifier and TypeMethodDescriptionstatic void
run the testsvoid
test1()
test sending string literalsvoid
test2()
test sending a format string with parametersvoid
test3()
test exception handlingvoid
test4()
test exception handlingvoid
test5()
test lazy evaluation. the slow functionnap()
will only run if the log level isFINEST
.
-
Field Details
-
LOGGER
logger instance for this class
-
-
Constructor Details
-
TestSplitLogger
public TestSplitLogger()constructor: prints some messages tostdout
, but not using the logger yet
-
-
Method Details
-
test1
public void test1()test sending string literals -
test2
public void test2()test sending a format string with parameters -
test3
public void test3()test exception handling -
test4
public void test4()test exception handling -
test5
public void test5()test lazy evaluation. the slow functionnap()
will only run if the log level isFINEST
. -
main
-