Hi Winkers,

I committed a patch to WINK-261 that allows for logging in maven builds, and
allows capture of log output in unittests so asserts can be made on the the
log output itself.  In the past, I've been guilty of breaking things when
debug was turned on that would otherwise run fine.  I want to do whatever is
necessary to protect us!  :)  So, with that, there are two new capabilities
around logging under WINK-261:

1)  If you desire to turn on debug logging in maven build of the whole tree
or of a particular component, you only need to add a param to your mvn
command line:

     mvn -Djava.util.logging.config.file=/full/path/to/logging.properties

     There is a default properties file at
wink-component-test-support/src/main/resources/logging.properties.
     The log output goes into the respective
target/surefire-reports/*-output.txt files.

     To perform the same in Eclipse, pass
-Djava.util.logging.config.file=/full/path/to/logging.properties in the JVM
args field
     in the Run dialog box.  You'll get output in the *-output.txt files and
on the Eclipse console.

2)  If you desire to capture debug output in a specific unittest method to
perform asserts on the log output itself, you can now do so!  You can write
a test like so:

    public void testLogging() throws Exception {
        WinkLogHandler.turnLoggingCaptureOn();  // WinkLogHandler imported
from wink-component-test-support module
        ApplicationFileLoader applicationFileLoader =
            new ApplicationFileLoader("application//custom.app");
        WinkLogHandler.turnLoggingCaptureOff();
        ArrayList<LogRecord> logRecords = WinkLogHandler.getRecords();
        assertEquals(14, logRecords.size());
        WinkLogHandler.clearRecords();  // recommend doing this so static
ArrayList of LogRecords is clear for next test
    }

Please let me know if you have any questions.

Thanks.
mike

Reply via email to