RFR: 8177136: Caller sensitive methods Logger.getLogger, Logger.getAnonymousLogger, and System.getLogger should throw IllegalCallerException if there is no caller on the stack.

Daniel Fuchs daniel.fuchs at oracle.com
Mon Mar 20 21:33:00 UTC 2017


On 20/03/17 21:28, David Holmes wrote:
> If you are going to introduce an API with such a constraint then the
> constraint needs to be clearly documented and the alternatives also
> documented IMHO. System.getLogger relies on a notion of "current module".

Yes:

     Instances returned by this method route messages to loggers 
obtained by calling LoggerFinder.getLogger(name, module), where module 
is the caller's module.

-- daniel


More information about the core-libs-dev mailing list