How to enable trace logging for offline compaction
search cancel

How to enable trace logging for offline compaction

book

Article ID: 294473

calendar_today

Updated On:

Products

VMware Tanzu Gemfire

Issue/Introduction

Current gfsh offline compaction command doesn't have the option to enable offline compaction logging trace while the offline compaction operation may take a long time to complete when massive diskstore oplog garbage needs to be removed. We want to know the progress of offline compaction or want to trace the offline compaction logging. This knowledge article intends to introduce a way to enable debug and trace level logging, especially for PERSIST_RECOVERY_VERBOSE and RVV_VERBOSE, by leveraging log4j configuration file.

Environment

Product Version: 9.10
OS: Linux

Resolution

You can add "-Dlog4j.configurationFile" with a customized log4j2.xml configuration file to the JAVA_ARGS environment variable before running the gfsh offline compaction command. After offline compaction completes, you can find the generated offlinecompaction_disk_store.log in the current directory.

export JAVA_ARGS="-Dlog4j.configurationFile=offlinecompaction_log4j-debug-logging.xml"

gfsh compact offline-disk-store --name=dataDiskStore --disk-dirs=/home/gfadmin/apps/gfExampleCluster/server1/storage/data


Example of offlinecompaction_log4j-debug-logging.xml:

<Configuration status="FATAL" shutdownHook="disable" packages="org.apache.geode.internal.logging.log4j">
  <Properties>
    <Property name="geode-pattern">[%level{lowerCase=true} %date{yyyy/MM/dd HH:mm:ss.SSS z} [%thread] tid=%hexTid] %message%n%throwable%n</Property>
  </Properties>
  <Appenders>
    <File name="FILE" fileName="offlinecompaction_disk_store.log">
      <PatternLayout pattern="${geode-pattern}"/>
    </File>
  </Appenders>
  <Loggers>
    <Logger name="org.apache.geode" level="TRACE" additivity="true">
      <Filters>
        <MarkerFilter marker="RVV_VERBOSE" onMatch="ACCEPT" onMismatch="NEUTRAL"/>
        <MarkerFilter marker="PERSIST_RECOVERY_VERBOSE" onMatch="ACCEPT" onMismatch="NEUTRAL"/>
      </Filters>
    </Logger>
    <Logger name="org.jgroups" level="FATAL" additivity="true"/>
    <Root level="TRACE">
      <AppenderRef ref="FILE"/>
    </Root>
  </Loggers>
</Configuration>