Caffeinated
Caffeinated

Reputation: 12484

Am I setting the log4j home System Variable(for Classpath) correctly?

I'm having alot of trouble setting up log4J on windows. I am reading the online how-to but it's not really clicking:

So this is how I set my System Variable:

enter image description here

The full var. value is :

C:\apache-log4j-2.0-beta4-bin\org\apache\logging\log4j\core

And then I add the LOG4J_HOME variable tothe PATH variable.

But I still get errors when compiling. Does anybody have pointers on this? Thank You Very Much

Upvotes: 1

Views: 1216

Answers (2)

oohtj
oohtj

Reputation: 129

As far as I know, you probably have to add string ";C:\apache-log4j-2.0-beta4-bin\org\apache\logging\log4j\core" to the tail of windows's system variable 'CLASS_PATH'. If you can't found 'CLASS_PATH' in your system variables list, then you have to add it. After this, log out your windows account and log in. It should work.

Upvotes: 1

Remko Popma
Remko Popma

Reputation: 36834

Let's see, you have unzipped the apache-log4j-2.0-beta4-bin.zip to C:\ drive. This gives you a whole bunch of jar files in that directory. You don't need to unzip these jar files.

Instead, when you compile your java program, you add some of these jar files to the classpath. You probably only need to add

  1. log4j-api-2.0-beta4.jar
  2. log4j-core-2.0-beta4.jar

These two jar files are usually enough. The other jar files are helpers for special cases. Some cannot be used together, so don't just add all of them!

The details of how to add these jar files to the classpath when compiling depends on what you are using to compile.

By the way, log4j 2.0 beta5 was released recently with some new features and lots of bugfixes.

Upvotes: 1

Related Questions