Global logger always logs for child loggers - unless you subclass logger?

I have extended the java.util.logging.Handler class, but I am unable to disable the global logging Handler ej.util.logging.handler.DefaultHandler from handling my logger output.
I can set the logger Logger.GLOBAL_LOGGER_NAME logging to Level.OFF, which stops the global logger from outputting, but other loggers using getLogger(“SomeString”) are still executing the global Default handler, as the parent handler code is called without respect to the parents (Level.OFF) filter level.

I cannot see a way to ‘extract’ the global Handler information such that I would be able to call removeHandler() so cannot see an obvious way of disabling the global DefaultHandler?

I have however realised (whilst writing this) that I can subclass the Logger and use the protected Logger(String, String) constructor and it does not set the parent.

Should the global “parent” logger use its filter level and not that of the child’s though?

If you are looking to completely disable the DefaultHandler, you can override the system property handlers to set your own default handler.
To do so, in the folder src/main/resources:

  • create a file and add the line handler=my.package.handlerClass
  • create a file file.types.list and add the line my.package.handlerClass.

However, if you are looking to have the possibility to use both the DefaultHandler and your own handler, there is indeed a problem in the library.
We are taking note of this issue and will be looking at it as soon as posible.

Best regards,