Groovy unit test with slf4j logging does not show log statements in the console window.

Hi.

I have a simple groovy unit test which does some logging that i'd like to see. (see code below).
My problem is that i can see the output from println statements, but not when i do calls to

    logger.error

As you can see i have ensured that my logging threshold is set to at least error ...
But I see no output.. I explored the options in 'Edit Configurations' window
(Logs tab).. But nothing seemed relevant.

I'm wondering if I need to programatically add slf4j's equivalent of a ConsoleHandler, as
was described in this post >  http://devnet.jetbrains.net/message/5282057#5282057

  [  Note. i actually tried the code in that post and it does give logging output.. but i'm
    hoping i don't have to programatically set this up in each of my unit test classes.. that will
    add a lot of clutter ]

Thanx for your  help  in advance !
    chris


-- CODE --

import org.slf4j.Logger;
import org.slf4j.LoggerFactory



class CloudRegistryTest  extends GroovyTestCase  {
  private static Logger logger = LoggerFactory.getLogger(CloudRegistryTest.class.name)
  public void testFoo() {
    if (logger.isErrorEnabled()) {
      println "error on "
    } else {
      println "error off "
    }
    println "responsehi ho"                     // This shows up in the console window
    logger.error ">> responsehi ho"             // This does not show up


  }
}

1 comment
Comment actions Permalink

Oh.. I forgot to mention..

I imported a simple grails app from existing sources... (that's how i set up my project)

also, I am using Idea version 10 (which i just downloaded today)

thanks

0

Please sign in to leave a comment.