GemFire uses Log4j to register execution logs, so it is needed to write a custom configuration and make usage of the filters provided by Log4j to avoid the log of a particular message.
The overview of how to implement Log4J custom filters is described in the User's Guide.
For most scenarios the RegexFilter will be sufficient to filter out certain messages. The following sample configuration is the default used by GemFire plus a RegexFilter
to avoid logging errors containing [TEXT IN Log Entry:
<?xml version="1.0" encoding="UTF-8"?> <Configuration status="FATAL" shutdownHook="disable" packages="com.gemstone.gemfire.internal.logging.log4j"> <Properties> <Property name="gemfire-pattern">[%level{lowerCase=true} %date{yyyy/MM/dd HH:mm:ss.SSS z} <%thread> tid=%tid] %message%n%throwable%n</Property> </Properties> <Appenders> <Console name="STDOUT" target="SYSTEM_OUT"> <PatternLayout pattern="${gemfire-pattern}"/> </Console> </Appenders> <Loggers> <Logger name="com.gemstone" level="INFO" additivity="true"> <filters> <MarkerFilter marker="GEMFIRE_VERBOSE" onMatch="DENY" onMismatch="NEUTRAL"/> <RegexFilter regex=".*[TEXT IN LOG ENTRY].*" onMatch="DENY" onMismatch="NEUTRAL"/> </filters> </Logger> <Root level="ERROR"> <AppenderRef ref="STDOUT"/> </Root> </Loggers> </Configuration>
To override the default configuration used by GemFire, start up the servers using the system property log4j.configurationFile
pointing to a local log4j configuration file, as an example:
gfsh start server --name=name --J=-Dlog4j.configurationFile=/config/log4j2-custom.xml.
GemFire 8.0 and later
Reference
More information about Log4j filters can be found at the Apache Log4J project.