Where Should I Put the Log4J.Properties File

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

Where to put log4j.properties file

There is no need to include a log4j.xml or logging.properties configuration file with your application if you're using JBoss AS 7. The only reason to do that would be to use an appender that is not included in the JBoss AS 7 logging subsystem.

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

Should I put log4j.properties file into library?

You should put your log4j.properties outside your jar file because it will be easier to modify it. If the application does not force a reload of the configuration (you can do that) then a simple restart will load the config (while modifying it inside a jar file means usually a rebuild). If the application does know how to reload it, then your changes will be almost instantly applied.
This is very important when you have application in production environment, and you want to change a logging setting (like the log level) in order to get more info but not to stop the application for this (or worse, rebuild it).

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.

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.



Related Topics



Leave a reply



Submit