How to add logging for specific areas to defined LogMarkers in GemFire
search cancel

How to add logging for specific areas to defined LogMarkers in GemFire

book

Article ID: 294453

calendar_today

Updated On:

Products

VMware Tanzu Gemfire

Issue/Introduction

This article covers how to add more logging in GemFire when you want to maximize logging in specific areas by using defined LogMarkers.

Environment

Product Version: 9.10
OS: All

Resolution

The GEODE_VERBOSE marker can be used to enable additional verbose log statements at the TRACE level. Many log statements are enabled by enabling DEBUG or TRACE

For more information on Log4J2 Markers, refer to Log4j 2 API - Markers

However, even more log statements can be further enabled by using MarkerFilter to accept GEODE_VERBOSE.

By default, log4j2.xml disables GEODE_VERBOSE with this line:
<MarkerFilter marker="GEODE_VERBOSE" onMatch="DENY" onMismatch="NEUTRAL"/>

You can enable the GEODE_VERBOSE log statements by changing onMatch="DENY" to onMatch="ACCEPT".

In most cases, it is more useful to simply enable DEBUG or TRACE on certain classes or packages instead of for the entire GemFire product. However, this setting can be used for internal debugging purposes if all other debugging methods fail.

The above GEODE_VERBOSE marker covers a wide range of markers, as it is the parent marker of many markers. If you want to limit the amount of logging to a specific area of code, where you are seeing a defined LogMarker, it is worth considering adding a line similar to the following to your log4j2.xml after the GEODE_VERBOSE line as seen below:
<MarkerFilter marker="GEODE_VERBOSE" onMatch="DENY" onMismatch="NEUTRAL"/>
<MarkerFilter marker="DM_VERBOSE" onMatch="ACCEPT" onMismatch="NEUTRAL"/>

Note: Given much of GemFire is now open source with our GEODE offering, you can see what logging messages may be available by searching for "LogMarker.*" or "LogMarker.*_VERBOSE" in all of the GEODE source.