logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sverre Moe <sverre....@gmail.com>
Subject Wrong Exports and Automatic Module Name
Date Sat, 23 Jun 2018 12:00:17 GMT
Apache Log4j may have a wrong Automatic-Module-Name
requires org.apache.logging.log4j.core;

I cannot use the Logger and LogManager classes because they are not
accessible to my module.

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
private Logger logger = LogManager.getLogger(this.getClass());

The type org.apache.logging.log4j.LogManager is not accessible
The type org.apache.logging.log4j.Logger is not accessible

> "This is the central interface in the log4j package. Most logging operations, except
configuration, are done through this interface. The canonical way to obtain a Logger for a
class is through {@link LogManager#getLogger()}."

The Logger implementation is accessible:
import org.apache.logging.log4j.core.Logger;

It seems to me that the classes in core package is not to be accessed
directly by those using Log4j.

This leads me to believe no one has actually begun to use Log4j in a
modular project. Because how can they when they cannot access the API.

The Automatic-Module-Name should be instead "org.apache.logging.log4j".
If the classes under the core package should not be used then it
should not be exported.
Perhaps then the Automatic-Module-Name needs to be
"org.apache.logging.log4j.api".

But this is just the automatic module name that log4j has set. What is
actually exported is also wrong. The Export-Package in JAR MANIFEST.MF
exports not the API, but the implementation.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message