views:

50

answers:

2

Dear All:

Sorry this is probably a very simple question.

I am using gradle http://www.gradle.org/ for my development environment. It works quite well!

I have written a simple unit test that uses HtmlUnit and my own package.

For my own package, I use java.util.Logger.

HtmlUnit seems to use commons logging: http://htmlunit.sourceforge.net/logging.html

I would like to see console output of my logging messages from java.util.Logger

However, it seems that even messages at the info level are not displayed in my Unit Test Results GUI (System.err link), although the HtmlUnit messages are all displayed.

Please let me know if you have suggestions.

Thank you! Misha

A: 

Bridging logging systems from library's that use their own is complicated. Why not use slf4j's bridging JAR's? They will redirect old calls to commons logging to it's own logging system which YOU design against.

Take a look at http://www.slf4j.org/legacy.html

TheLQ
Thank you. I'm still a bit confused though.Which logging output can _I_ use that will get displayed in the Unit Test Results?I mean for my own programs.Thank youMisha
Misha Koshelev
A: 

Ok. I figured it out. It was quite odd.

Namely, if I initialize the logger outside of any methods:

class foo {
   def log=Logger.getLogger(this.class.name)
}

log output is not seen when I write a test.

However, if I initialize the logger inside the constructor

class foo {
   def log
   foo() {
      log=Logger.getLogger(this.class.name)
   }
}

Then it works fine. Odd...

Thank you! Misha

Misha Koshelev