Where Is the Correct Location to Put Log4J.Properties in an Eclipse Project

Where is the correct location to put Log4j.properties in an Eclipse project?

you can add it any where you want, when you run your project, configure the classpath and add the location of the log4j.properties files by clicking on:
Run->Run Configuration -> [classpath tab] -> click on user Entries -> Advanced -> Select Add Folder -> select the location of your log4j.properties file

and then -> OK -> run

and it should get loaded

How to add path of log4j.properties file in my project classpath in eclipse?

Right click on the folder, select Build Path then Use as a Source Folder.

Just remember that when you will deploy you will need to create a directory for resources and add it to class path.

You should also consider to use maven for your java project, it may seem overkill initially but it will pay off in the long run.

log4j.properties, where to put it

maybe the file log4j.properties is being read correctly and the problem is with the configuration in log4j.properties file. Does adding this line to the begining of log4j.properties make any difference (assuming that you are have some logging statements in your class files)

log4j.rootLogger=DEBUG, dest1

where to put log4j.properties in java gradle web application on eclipse

log4j.properties is typically read from the web app's class path, and as such you would put it into src/main/resources.

Change location of log4j.properties

Yes, define log4j.configuration property

java -Dlog4j.configuration=file:/path/to/log4j.properties myApp

Note, that property value must be a URL.

For more read section 'Default Initialization Procedure' in Log4j manual.

Getting log4j2 to work with eclipse

Manage to figure this one out. The hint was here.

http://pic.dhe.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftasks-112.htm

I needed to add a "class folder" of where the log4j2.xml was located and then make sure it was at TOP of the list:

Right click on your project and go to properties
Right click on your project and go to properties

Then follow the step shown below. After adding the folder make sure its at the top and then click ok
Sample Image



Related Topics



Leave a reply



Submit