Hi guys! I’m trying to debug some queries that i wrote in CriterionStatisticsDAOImpl and WebResourceStatisticsDAOImpl. What should i do to write LOGGER.DEBUG messages to a file and see them? I tried to configure Asqatasun/engine/asqatasun-api/src/test/resources/log4j.properties file like this:
# Set root logger level to DEBUG and its only appender to CONSOLE.
#sortie console
log4j.rootLogger=DEBUG,file,CONSOLE_APP
# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.RollingFileAppender
#Redirect to Tomcat logs folder
log4j.appender.file.File=${catalina.home}/logs/logging.log
Also replaced all INFO appearances by DEBUG in /Asqatasun/web-app/asqatasun-web-app/target/asqatasun-web-app-4.1.0-SNAPSHOT/WEB-INF/classes/log4j.properties but everytime i compile Asqatasun it changes back to INFO.
Before going on, one important thing must be understood in the build process:
Your sources are located in, say, /home/nivak91/sources/asqatasun/. When you code, these are the files you modify
When you build (mvn clean install), the artifacts (artifact = product of the build) are in the target/ directories.
Once built, you’ll want to test, thus install your Asqatasun:
If you never installed Asqatasun, grab the whole archive (from /home/nivak91/sources/asqatasun/web-app/asqatasun-web-app/target/, file asqatasun-4.1.0-SNAPSHOT.i386.tar.gz), unpack it and install Asqatasun (this is the long way).
If you’ve already installed Asqatasun on your machine, and you did not modify the DB schema, then you can copy the WAR file (grab it from /home/nivak91/sources/asqatasun/web-app/asqatasun-web-app/target/asqatasun-web-app-4.1.0-SNAPSHOT.war) and copy it into your Tomcat webapp directory, typically /var/lib/tomcat7/webapp/, no need to restart tomcat, just wait for the deployment to be done. This is the short way.
If you don’t want to bother with the installation stuff, you can use the Compile and build docker image script, which does what its name suggests with plenty of usefull options (-h option will give you everything). This is the way.
That being said, from the paths you mention, I think you modified the log4j.properties that is deployed (i.e. after the build is done). Thus that’s no surprise you’ve got to modify it after each build.
To avoid this, you’d better modify directly the log4j.properties from the sources, which is located in <path-to-asqatasoun-sources>/web-app/asqatasun-web-app/src/main/resources/log4j.properties.
Your files (CriterionStatisticsDAOImpl and WebResourceStatisticsDAOImpl) are in the module org.asqatasun.entity.dao, so add the following line to your log4j.properties:
Ok guys @fabrice@mfaure i edited web-app/asqatasun-web-app/src/main/resources/log4j.properties like this: Changed ERROR to DEBUG in log4j.rootLogger=DEBUG,FILE_APP and also added log4j.logger.org.asqatasun.webapp = DEBUG because i want to debug under this module. But when i add something like LOGGER.debug(“mesage”) in a class after of course declaring private static final Logger LOGGER = Logger.getLogger(SomeClass.class) in the class i want to debug i get nothing in /var/log/asqatasun.log…