On Wed, Apr 14, 2021 at 12:43 AM Ralph Goers <ralph.go...@dslextreme.com> wrote:
> I started doing the work to modularize log4j-core last night. We have a > blocker in that the disruptor has not had a release in 3 years. They > committed the change to make it an automatic module over a year ago and > since have fully modularized it. They simply haven’t performed a release. > > As I was going through the module descriptor (see below) it seems to me > that we have far more dependencies in core than I would really like. For > example, despite moving the Jackson Layouts to their own modules we still > have a dependency on Jackson. We also have dependencies on things like > java.rmi, java.naming, java.sql. I am also not clear on whether they are > all really optional or not. Ideally, the only required dependency we should > have is for java.base. For example, we need java.rmi because Log4jLogEvent > uses MarshalledObject. I have no idea why we need that particular class to > wrap a log event. Couldn’t we have created our own class for that? My memory is a bit vague, but I think the reason for using a JDK class and not a log4j class was to prevent memory leaks in thread pools shared across web applications in servlet containers. Perhaps I am confusing things here, but you may remember that if there is a reference to a log4j class in a threadlocal, then that can prevent all log4j classes from being garbage collected when the web app is restarted. By serializing all data into a JDK class we avoid that problem. We could also serialize into a byte array I guess, that would work just fine as well. At the time I thought that MarshalledObject expressed the intent better than a byte array, and it has some convenience methods for serializing and deserializing. Other than that there is nothing special about MarshalledObject itself. > We need java.desktop because java.beans now lives there. Perhaps we could > look at what those are and if it is really just one or two utility methods > implement them locally. > > In the meantime I have created an issue with the Disruptor asking for a > release. I can’t do much more with core until that is available. I can move > on to other modules. > > We also need to look at the list of exports below and the classes in them > and determine what is really public and what should be private. > > > Thoughts? > > Ralph > > > module org.apache.logging.log4j.core { > exports org.apache.logging.log4j.core; > exports org.apache.logging.log4j.core.appender; > exports org.apache.logging.log4j.core.appender.db; > exports org.apache.logging.log4j.core.appender.nosql; > exports org.apache.logging.log4j.core.appender.rewrite; > exports org.apache.logging.log4j.core.appender.rolling; > exports org.apache.logging.log4j.core.appender.rolling.action; > exports org.apache.logging.log4j.core.appender.routing; > exports org.apache.logging.log4j.core.async; > exports org.apache.logging.log4j.core.config; > exports org.apache.logging.log4j.core.config.arbiters; > exports org.apache.logging.log4j.core.config.builder.api; > exports org.apache.logging.log4j.core.config.builder.impl; > exports org.apache.logging.log4j.core.config.composite; > exports org.apache.logging.log4j.core.config.json; > exports org.apache.logging.log4j.core.config.plugins; > exports org.apache.logging.log4j.core.config.plugins.convert; > exports org.apache.logging.log4j.core.config.plugins.inject; > exports org.apache.logging.log4j.core.config.plugins.util; > exports org.apache.logging.log4j.core.config.plugins.visitors; > exports org.apache.logging.log4j.core.config.properties; > exports org.apache.logging.log4j.core.config.status; > exports org.apache.logging.log4j.core.config.xml; > exports org.apache.logging.log4j.core.config.yaml; > exports org.apache.logging.log4j.core.filter; > exports org.apache.logging.log4j.core.impl; > exports org.apache.logging.log4j.core.jmx; > exports org.apache.logging.log4j.core.layout; > exports org.apache.logging.log4j.core.lookup; > exports org.apache.logging.log4j.core.message; > exports org.apache.logging.log4j.core.net; > exports org.apache.logging.log4j.core.net.ssl; > exports org.apache.logging.log4j.core.osgi; > exports org.apache.logging.log4j.core.parser; > exports org.apache.logging.log4j.core.pattern; > exports org.apache.logging.log4j.core.script; > exports org.apache.logging.log4j.core.selector; > exports org.apache.logging.log4j.core.time; > exports org.apache.logging.log4j.core.tools; > exports org.apache.logging.log4j.core.tools.picocli; > exports org.apache.logging.log4j.core.util; > exports org.apache.logging.log4j.core.util.datetime; > > requires transitive java.desktop; > requires transitive java.management; > requires java.naming; > requires transitive java.sql; > requires java.rmi; > requires transitive java.scripting; > requires java.xml; > requires org.apache.logging.log4j; > requires org.apache.logging.log4j.plugins; > //requires transitive com.lmax.distruptor; > requires transitive org.osgi.core; > requires transitive com.conversantmedia.disruptor; > requires transitive com.fasterxml.jackson.core; > requires transitive com.fasterxml.jackson.databind; > requires transitive com.fasterxml.jackson.dataformat.xml; > requires transitive com.fasterxml.jackson.dataformat.yaml; > requires transitive org.apache.commons.compress; > requires transitive org.fusesource.jansi; > uses org.apache.logging.log4j.core.util.ContextDataProvider; > provides > org.apache.logging.log4j.message.ThreadDumpMessage$ThreadInfoFactory with > org.apache.logging.log4j.core.message.ExtendedThreadInfoFactory; > provides org.apache.logging.log4j.core.util.ContextDataProvider with > org.apache.logging.log4j.core.impl.ThreadContextDataProvider; > provides org.apache.logging.log4j.spi.Provider with > org.apache.logging.log4j.core.impl.Log4jProvider; > provides org.apache.logging.log4j.plugins.processor.PluginService with > org.apache.logging.log4j.core.plugins.Log4jPlugins; > >