I created a class MyLogger that extends java.util.Logger in my project and I want each class to use the same logger therefore there is a static getLogger()
method which returns a Logger
object.
The plan is for this to be a jar file that can be included in other people's programs, but I don't want them to be able to use this custom logger (ie. if they want logging they need to set it up themselves with their own logger).
Is there any way to allow the MyLogger
class be in its own package while allowing the rest of the classes in my project/jar be able to access the getLogger()
method, but not allow classes outside my project to call it (kinda like package private, but for the whole project) or is the only way to put it in my "parent" package?