netbeans-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geertjan Wielenga <geertjan.wiele...@googlemail.com.INVALID>
Subject Re: Netbeans ant build script not finding Log4j2 V2.11.1 module-info.class
Date Wed, 03 Oct 2018 11:54:02 GMT
What I mean is that a starting point is to see whether what you've done
works on the command line. I.e., forget NetBeans for the moment and try and
build and run your solution on the command line and see if that works.

Gj

On Wed, Oct 3, 2018 at 1:51 PM Emma Atkinson <emma.atkinson2@gmail.com>
wrote:

> 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 module-info.java 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 module-info.java.
>
>
>    - RMB on Project Navigator > Log4j2TestCase  selected Properties >
>    Libraries.  I moved the reference to the jar files down into the classpath.
>
>
>    - I edited the module-info.java file to delete the automatically added
>    line
> * requires *org.apache.logging.log4j.core*;*
>
>
>    - I added two import statements to the Log4j2TestCase.java (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 module-info.java 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.
>
>
>
>

Mime
View raw message