javacachinglogginglog4jjcs

Set JCS log level to ERROR - log4j


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

Solution

  • 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