Hi Gary,

On 31.10.2024 17:12, Gary Gregory wrote:

set the configured level of a single logger
Some people (like me) will want to enable debug all in one go for example,
even for loggers that have not been instantiated yet.

I think we should distinguish whether this is set the level for a hierarchy
for just the one and the one only.

I would start with most common case of setting the (default) log level for a hierarchy. That requires a single operation in all the logging implementations I know.

The signature of a `setLevel` method might be tricky:

* Log4j Core does not create `Logger` instances for the internal nodes of the hierarchy (those that correspond to Java packages), so `setLevel(Logger, Level)` would be wasteful.

* JUL on the other hand does not guarantee the uniqueness of logger names and Tomcat and others use this to create a separate logger hierarchy per application, which makes `setLevel(String, Level)` trickier to implement.

* Logback is the easiest of the 3, since it just creates all the loggers and makes sure that their names are unique.

One thing is constant: logger names are dot-separated strings and the name of the parent logger omits the last component of the logger's name.

Piotr

Reply via email to