Log
Normal use in code:
...
Log log = LogSystem.getLog("My Component");
...
log.debug(8, "Hey, made it this far!");
or
private static final LogDataKeys FUBAR_INFO = new LogDataKeys("Fubar", new String[]{"foo", "bar"});
...
Log log = LogSystem.getLog("My Component");
...
log.info( FUBAR_INFO, new String[]{ "foo-value", "bar-value" }, "This Fubar'd" );
The log is initialize at startup with code like this:
LogSystem.initialize( new LogWriter(new SyslogFormatter(), new OutputStreamWriter(new LogOutputStream())));
But when testing code that has logging (JUnit testing), the default initialization is used, which just logs to the console.
Optionally, you may initialize like this:
protected void setUp() throws Exception {
super.setUp();
...
mTestOutput = new StringWriter();
LogSystem.initialize(new LogWriter( new SyslogFormatter(), mTestOutput));
mTestOutput.getBuffer().setLength(0); // clear startup message
mLog = LogSystem.getLog("testLog");
...
}
which will let you capture the log output in the test. You can parse this, and possibly use it to verify some test results.