Hello everybody.
I am using log4j in my project. Everything works fine if i leave my log4j.properties (where i have all my appenders) just inside my \src folder. But what i want to do is to have it as an external file, so i can stop my program, modify the properties file and start it again (for example to change the logging level from trace to info). To achieve this i:
-)modified build.xml to copy the property file in the dist folder: <target name="-pre-compile"> <copy file="log4j.properties" tofile="./build/log4j.properties"/> <copy file="log4j.properties" tofile="./dist/log4j.properties"/> </target>
-)I am initializing the properties of log4j in my logging class (static initializer called once): PropertyConfigurator.configure(getInstallationFolder()+"\\log4j.properties"); //getInstallationFolder() give me the dist folder This way everything works, can change the file and restart the program, and can see that the log format has changed. But hibernate does not find the property file, or at least is looking for it somewhere else. In fact i get the usual message:
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please initialize the log4j system properly.
Basically how can i say to hiberante where to look for that file? Libraries and everything else is configured right, in fact if i leave the property file in the \src (classpath) the loggings of hibernate are fine. Any help is welcome, thank you!!!!
|