You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Don Flinn <fl...@alum.mit.edu> on 2018/11/19 01:10:33 UTC

Failure to recognize the log4j2 jars

I have installed and have running log4j2 on Windows 10. I am attempting to
get it running on Ununtu, using the same procedure as before.  However in
the Ubuntu  case the system fails to recognize the import statement, .i.e.
can't find org in :
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;  and of course every other log4j2
statement fails.  It seems that it can't find the log4j-core-2.11.1.jar
file.  However, I can see both jar files, log4j-api-2.11.1.jar &
log4j-core-2.11.1.jar, in the Referenced Libraries.
The steps I took are outlined below.
1. Create lib folder
2. copy log4j-api  & log4j-core to lib
3. click on above files;  f5 to refresh chose above files
6. buildpath ->AddToBuildPath The JARs will disappear from lib and reappear
in Referenced Libraries.
7. above puts them in classpath
7, Ref.
https://www.wikihow.com/Add-JARs-to-Project-Build-Paths-in-Eclipse-(Java)
8. Set log4j2.xml
9. Create config
3 copy to src folder

i've tried the above multiple times, logging out of eclipse between
attempts and not logging out.
Any help would be appreciated
Don

Re: Failure to recognize the log4j2 jars

Posted by Shawn Heisey <ap...@elyograg.org>.
On 11/18/2018 6:10 PM, Don Flinn wrote:
> I have installed and have running log4j2 on Windows 10. I am attempting to
> get it running on Ununtu, using the same procedure as before.  However in
> the Ubuntu  case the system fails to recognize the import statement, .i.e.
> can't find org in :
>   import org.apache.logging.log4j.LogManager;
>   import org.apache.logging.log4j.Logger;  and of course every other log4j2
> statement fails.  It seems that it can't find the log4j-core-2.11.1.jar
> file.  However, I can see both jar files, log4j-api-2.11.1.jar &
> log4j-core-2.11.1.jar, in the Referenced Libraries.

Those classes are in log4j-api, not log4j-core.  You have both, so 
that's a distinction that shouldn't matter much.

https://www.dropbox.com/s/g7ui8ldz02x8nlf/eclipse-log4j-api.jar.png?dl=0

(the build.gradle file that's you can see open in the editor has nothing 
to do with the project where I have the log4j-api jar open.  The project 
where I opened that jar is lucene-solr, an Apache project)

It's really odd that this is happening if you have the jars in 
Referenced Libraries.  Maybe you need to clean the project and have 
eclipse completely rebuild it.  In Eclipse, go to the Project menu.  
Choose Clean.  At that point you can leave the checkbox in "Clean all 
projects" or uncheck it and choose the project(s) you want it to 
affect.  Then click the "Clean" button.

If that doesn't work, you may need to consult an expert in Eclipse.  I 
use it a lot, but I'm not an expert.

Thanks,
Shawn


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