diff --git a/skel/bin/dcache b/skel/bin/dcache index e31a0a8fa90..30c5c80f545 100755 --- a/skel/bin/dcache +++ b/skel/bin/dcache @@ -45,6 +45,7 @@ usage() echo " database doc @ " echo " dump heap [--force] " echo " dump threads [...]" + echo " dump zklog []" echo " kpwd [-debug] []..." echo " ports" echo " pool convert " @@ -665,6 +666,24 @@ case "$1" in done ;; + zklog) + [ $# -gt 1 ] && usage + dir="$(getProperty zookeeper.data-log-dir)/version-2" + [ $# -eq 1 ] && dir="$1" + + [ ! -d "$dir" ] && fail 1 "No such directory: $dir" + + ls -r -t "$dir/log."* 2>/dev/null \ + | while read f; do + name=$(basename "$f") + echo + echo "TRANSACTION LOG FILE $name:" + echo + CLASSPATH="$(getProperty dcache.paths.classpath)" quickJava org.apache.zookeeper.server.LogFormatter "$f" \ + | awk '{print " "$0}' + done + ;; + *) usage ;; diff --git a/skel/man/man8/dcache.8 b/skel/man/man8/dcache.8 index 3e49bb54264..10a243b2d6c 100644 --- a/skel/man/man8/dcache.8 +++ b/skel/man/man8/dcache.8 @@ -344,6 +344,13 @@ SERVICE. If no services or domains are specified, stack traces of all running domains will be dumped. The information is written to the log files of the respective domains. +.TP +.B dump zklog [PATH] +List the transactions recorded in the ZooKeeper server log files. +These are 'log.' files located within PATH. If PATH is omitted then +the expanded value of '${zookeeper.data-log-dir}/version-2' is used. +The transaction information is written to standard out. + .SH DEFINITIONS The following definitions are used throughout this document: