groovy - Why doesn't calling log.info produce output? -


please @ piece of code:

import java.util.logging.logger  class base {    logger log = new logger(base.getclass().name);    static main(args) {     def b = new base();     b.log.info('hello');   }  } 

when compile don't see errors or warnings. when try execute see empty output. why?

don't instantiate new logger, use logger.getlogger() retrieve/create logger want.

 logger logger = logger.getlogger(base.class.name)  logger.info('hello') 

however, if want use new logger(), looks need assign handler show log output.

logger logger = new logger(base.class.name) logger.addhandler(new java.util.logging.consolehandler()) logger.info('hello') 

Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -