Hi everyone,
As I don't want to monitor the configuration and runtime of JCS, I tried
the following approach but it still prints out the debug messages.
1. Defined log4j2.xml file with level="OFF" like
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<!-- Console Appender -->
<Console name="Console" target="SYSTEM_OUT">
<!-- Root Logger -->
<Root level="OFF">
<AppenderRef ref="Console"/>
</Root>
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} [%t] %-5level
%logger{36} - %msg%n" />
</Console>
<!-- File Appender -->
<RollingFile name="File" fileName="logs/jcs.log"
filePattern="logs/jcs-%d{yyyy-MM-dd}.log.gz">
<PatternLayout>
<Pattern>%d{yyyy-MM-dd HH:mm:ss} [%t] %-5level %logger{36}
- %msg%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy />
</Policies>
</RollingFile>
</Appenders>
<Loggers>
<!-- Root Logger -->
<Root level="OFF">
<AppenderRef ref="Console"/>
</Root>
<!-- JCS specific logging -->
<Logger name="org.apache.jcs" level="OFF" additivity="false">
<AppenderRef ref="Console"/>
<AppenderRef ref="File"/>
</Logger>
<Logger name="org.apache.commons.jcs" level="OFF"
additivity="false">
<AppenderRef ref="Console"/>
<AppenderRef ref="File"/>
</Logger>
<Logger name="org.apache.commons.jcs3" level="OFF"
additivity="false">
<AppenderRef ref="Console"/>
<AppenderRef ref="File"/>
</Logger>
</Loggers>
</Configuration>
2. Defined the log configuration file in the JVM command like the following
${JAVA_HOME}/bin/java -classpath ${CLASSPATH}
-Dlog4j.configurationFile=file:/opt/JCS/test/config/log4j2.xml TestMain
3. It still prints out the log messages to the console output
[jjeong@john-oel8 test3]$ ./runTest.sh
Feb 05, 2025 8:28:54 PM
org.apache.commons.jcs3.engine.control.CompositeCacheManager
INFO: Instance is null, returning unconfigured instance
Feb 05, 2025 8:28:54 PM
org.apache.commons.jcs3.engine.control.CompositeCacheManager
INFO: Setting default auxiliaries to "LTCP"
Feb 05, 2025 8:28:54 PM
org.apache.commons.jcs3.engine.control.CompositeCacheManager
INFO: setting defaultCompositeCacheAttributes to [ useLateral = true,
useRemote = true, useDisk = true, maxObjs = 200001, maxSpoolPerRun = -1,
diskUsagePattern = SWAP, spoolChunkSize = 2 ]
....
....
Feb 05, 2025 8:28:54 PM
org.apache.commons.jcs3.auxiliary.lateral.socket.tcp.LateralTCPService
SEVERE: Could not create sender to [localhost:1119] -- Cannot connect to
localhost:1119
Feb 05, 2025 8:28:54 PM
org.apache.commons.jcs3.auxiliary.lateral.socket.tcp.LateralTCPCacheFactory
SEVERE: Failure, lateral instance will use zombie service
java.io.IOException: Cannot connect to localhost:1119
at
org.apache.commons.jcs3.auxiliary.lateral.socket.tcp.LateralTCPSender.init(LateralTCPSender.java:141)
at
org.apache.commons.jcs3.auxiliary.lateral.socket.tcp.LateralTCPSender.<init>(LateralTCPSender.java:116)
Many thanks in advance,
John