logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <ralph.go...@dslextreme.com>
Subject Re: Wrong Exports and Automatic Module Name
Date Mon, 25 Jun 2018 16:07:30 GMT
Log4j-API is not an automatic module. It has a module-info.java file.

Log4j-API does not “require” log4j-core. It’s module-info specification is

exports org.apache.logging.log4j;
exports org.apache.logging.log4j.message;
exports org.apache.logging.log4j.simple;
exports org.apache.logging.log4j.spi;
exports org.apache.logging.log4j.status;
exports org.apache.logging.log4j.util;

uses org.apache.logging.log4j.spi.Provider;
uses org.apache.logging.log4j.util.PropertySource;
uses org.apache.logging.log4j.message.ThreadDumpMessage.ThreadInfoFactory;

Log4j-core IS an automatic module with a name of org.apache.logging.log4j.core. It cannot
be a “real” module because it has dependencies on libraries that have not declared themselves
to be Java 9 modules, automatic or otherwise. Therefore, it cannot declare that it provides
the three items log4j-api says it needs for an implementation to provide.

That said, we do have tests that pass and other users have pointed out problems in the module-info.java
that, once fixed, seemed to have made things work for them.


> On Jun 23, 2018, at 5:00 AM, Sverre Moe <sverre.moe@gmail.com> wrote:
> 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

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message