Pivotal Knowledge Base

Follow

GemFire Error: "java.io.FileNotFoundException" on log4j2-cli.xml

Environment

 Product  Version
 Pivotal GemFire  8.1.0 - 8.2.x
 OS  All Supported OS 

Symptom

In GemFire 8.1, Apache Log4j 2 was introduced as the internally used logging system. Log4j 2 provides better integration with other libraries and containers and introduces the usage of categories and markers to logging, which improves the GemFire debugging experience. Advanced users may want to configure Log4j 2 for use with GemFire or their application's third-party logging framework.

Although, when you want increased control over logging due to integration with third-party libraries by using the -Dlog4j.configurationFile parameter with your owner configurationFile name like log4j2-clixxxx.xml, you may see an error message like:
A. When <Configuration status="FATAL"> in log4j2-clixxxx.xml:

ERROR StatusLogger File not found in file system or classpath: /com/gemstone/gemfire/internal/logging/log4j/log4j2-cli.xml

OR

B. When <Configuration status="debug"> in log4j2-clixxxx.xml:

2016-12-06 16:11:56,083 DEBUG catching java.io.FileNotFoundException: /com/gemstone/gemfire/internal/logging/log4j/log4j2-cli.xml (No such file or directory)
	at java.io.FileInputStream.open0(Native Method)
	at java.io.FileInputStream.open(FileInputStream.java:195)
	at java.io.FileInputStream.(FileInputStream.java:138)
	at org.apache.logging.log4j.core.config.ConfigurationFactory.getInputFromString(ConfigurationFactory.java:332)
	at org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:402)
	at org.apache.logging.log4j.core.config.ConfigurationFactory.getConfiguration(ConfigurationFactory.java:254)
	at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:419)
	at com.gemstone.gemfire.internal.logging.LogService.init(LogService.java:81)
	at com.gemstone.gemfire.internal.logging.LogService.(LogService.java:76)
	at com.gemstone.gemfire.internal.cache.GemFireCacheImpl.(GemFireCacheImpl.java:225)
	at com.gemstone.gemfire.cache.CacheFactory.getAnyInstance(CacheFactory.java:293)
	at com.gemstone.gemfire.management.internal.cli.CliUtil.getCacheIfExists(CliUtil.java:122)
	at com.gemstone.gemfire.management.internal.cli.LogWrapper.(LogWrapper.java:49)
	at com.gemstone.gemfire.management.internal.cli.LogWrapper.getInstance(LogWrapper.java:70)
	at com.gemstone.gemfire.management.internal.cli.GfshParser.(GfshParser.java:75)
	at com.gemstone.gemfire.management.internal.cli.Launcher.(Launcher.java:68) 

Cause

This is a known issue (#GEM-966) which occurs when the log4j.configurationFile path is not converted to a proper URL in some places. 

Resolution

The GemFire engineering team is working on providing a fix for this issue. Until that is released, you can work around this error using the default log4j2-cli.xml name instead of log4j2-clixxxx.xml. 

For example:

gfsh start locator --name=locator1 --port=7900 --dir=locator1 --J=-Dlog4j.configurationFile=/home/gemfireadmin/test1/configuration/log4j2-cli.xml 

Reference

A similar known issue: GEODE-232

 

Comments

Powered by Zendesk