netbeans-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emma Atkinson <>
Subject Netbeans ant build script not finding Log4j2 V2.11.1 module-info.class
Date Wed, 03 Oct 2018 11:51:40 GMT
To recreate the test case and Netbeans set up.

   - I created a Java Application using the new project function.  I set it
   up to run on JDK 10.

   - I added a file using a RMB on Project Navigator >
   Log4j2TestCase > Source Packages > New > Java Module Info...

   - I created a Library entry (named Apache Log4j2 2.11) that refers to
   the log4j-api-2.11.1.jar via Tools > Libraries pressing New Library...
   button.  I only added the one jar, no javadoc, no sources.

   - Using a RMB on the Project Navigator > Log4j2TestCase > Libraries >
   Add Library... I added the Library entry named Apache Log4j2 2.11.

   - Using a RMB on the Project Navigator > Log4j2TestCase > Libraries >
   Add JAR/Folder ... I added a separate reference to log4j-api-2.11.1.jar and
   log4j-core-2.11.1.jar.  Netbeans put the log4j-core-2.11.1.jar on the
   modulepath and added a line to my

   - RMB on Project Navigator > Log4j2TestCase  selected Properties >
   Libraries.  I moved the reference to the jar files down into the classpath.

   - I edited the file to delete the automatically added
* requires *org.apache.logging.log4j.core*;*

   - I added two import statements to the (containing
   the main entry point)
* import* org.apache.logging.log4j.LogManager;
* import* org.apache.logging.log4j.Logger;

As it stands Log4j will not find its configuration XML file so it will say
that it is using default setting which means it output errors and above and
suppresses messages that are warnings, info and debug.

   - I created an object called LOGGER.

   - I created a LOGGER.error("some text "); so that it would output to the
   console under default settings if it ran.

But first we need to build the application.

   - Select the file and using a RMB menu option to
   Compile File.  The ant build script will run and eventually output an error
   message saying that it cannot find the module log4j.api.

I hope this is comprehensive enough.

View raw message