Set JCS log level to ERROR - log4j

1.3k Views Asked by At

I have implemented JCS in my J2ee application which uses log4j for logging.

My Requirement

Set the application rootLogger in DEBUG level and jcs logs in ERROR mode.

What is tried

Tried the following in log4j properties

log4j.category.org.apache.common.jcs=ERROR
log4j.logger.org.apache.common.jcs=ERROR

But nothing is affecting the logging.

Whenever the cache access happens, it logs a bunch of returning first node messages.

Note : I am using the latest JCS commons-jcs-core-2.0-beta-1.jar

This is my complete log4j.properties

log4j.rootLogger=DEBUG, A1

# Use Console Appender for development
 log4j.appender.A1=org.apache.log4j.ConsoleAppender

log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern= %d [%t] %-5p - %m%n

log4j.logger.net.sf.jasperreports=ERROR
log4j.category.org.apache.common.jcs=ERROR
2

There are 2 best solutions below

0
On BEST ANSWER

I missed an "s" in commons. Correcting it solved my problem.

Solution

Both the below statements can be used to configure JCS log level in log4j.

log4j.category.org.apache.commons.jcs=ERROR
log4j.logger.org.apache.commons.jcs=ERROR
0
On

JCS has a dependency on commons-logging for logging, and not log4j. Hence, log4j configurations won't matter unless you redirect commons-logging to log4j. To do that, create a file named commons-logging.properties and add the following in that.

org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4jLogger