I've setup (logger class constructor) logging as below-
Log() {
loggerObj = Logger.getLogger("");
//Create console handler and set its level and then setup its formatter
handler = new ConsoleHandler();
handler.setLevel(Level.FINEST);
formatter = new LogFormatter();
handler.setFormatter(formatter);
//assign handler to logger objs
loggerObj.setUseParentHandlers(false);
loggerObj.addHandler(handler);
}
Members of the Log class are-
static Logger loggerObj;
ConsoleHandler handler;
LogFormatter formatter;
Even though I've setup level to be FINEST and setUseParentHandlers to false, why is that I am not able to log anything below INFO?
EDIT- As per comment- After I modified the global logging.properties file and set level to ALL, it worked. So I think my question is why setUseParentHandlers isn't working?
setUseParentHandlers
specifies whether to send data recursively up the tree. Unless you explicitly don't want log messages to propagate to loggers that parent this one, that command shouldn't have any bearing on how your loggers behave in the context of a single log level specification. Perhaps I don't understand what you're asking for here? – MrGomez