eyanez1230
eyanez1230

Reputation: 31

How to configure logging level for JAWR using log4j.xml

Currently on our project we are seeing some DEBUG statements printed on our tomcat logs such as this:

12:09:00.824 [localhost-startStop-1] DEBUG n.j.w.r.h.b.AbstractResourceBundleHandler - Storing a generated bundle with an id of:/script/lib/itegration.dataTables.bootstrap.js 12:09:00.850 [localhost-startStop-1] DEBUG n.j.w.r.h.b.AbstractResourceBundleHandler - Storing a generated bundle with an id of:/script/lib/itegration.dataTables.bootstrap.js

We have determined that the debug statements that are being logged are caused because the condition LOGGER.isDebugEnabled() in the JAWR AbstractResourceBundleHandler.java class is always true. The snip of the code that logs is as follows:

if (LOGGER.isDebugEnabled()) {
    String msg = "Storing a generated "
            + (gzipFile ? "and gzipped" : "")
            + " bundle with an id of:" + bundleName;
    LOGGER.debug(msg);
}

As you can see there is a LOGGER.isDebugEnabled() which is always true. Is there a way to configure the logging level for this package/class/jar? We are currently using log4j as our logging framework and have tried configuring this package to log only INFO level but that has not worked. We also have the jawr.debug.on property set to false (jawr.debug.on=false)

I understand that JAWR is using slf4j for their logger and there is a way to use the slf4j bridge to log4j which we have configured, we just cannot get the logging level configuation for this package to work.

Does anyone know a way to set the LOGGER.isDebugEnabled() set to false so that these DEBUG log statements do not appear in our tomcat logs?

We are using log4j.xml not a properties file and would like to keep using the .xml configuration if possible.

Thank you

Upvotes: 0

Views: 225

Answers (1)

Francesco
Francesco

Reputation: 907

Adding this to our log4j.xml configuration file

<category name="net.jawr">
    <priority value="INFO" />
</category>

works fine.

Upvotes: 0

Related Questions