From 206fd324e33127d4c370007f223f8c12ab06b714 Mon Sep 17 00:00:00 2001 From: Poornima G Date: Tue, 2 Aug 2016 16:17:36 +0530 Subject: logging: Fix per xl log level Currently per xlator loglevel setting doesn't work, due to the flaw in loglevel checking. Fix the same. Per xlator logging can be set using the below command: Eg: setfattr -n trusted.glusterfs.patchy-md-cache.set-log-level -v TRACE /mnt/glusterfs/0 Change-Id: I8ff1d15bd5693b6f682d99bee22a4bbb5eee646c BUG: 1362520 Signed-off-by: Poornima G Reviewed-on: http://review.gluster.org/15071 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Niels de Vos Reviewed-by: Jeff Darcy --- tests/bugs/core/log-bug-1362520.t | 43 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 tests/bugs/core/log-bug-1362520.t (limited to 'tests/bugs/core') diff --git a/tests/bugs/core/log-bug-1362520.t b/tests/bugs/core/log-bug-1362520.t new file mode 100755 index 00000000000..cde854c3349 --- /dev/null +++ b/tests/bugs/core/log-bug-1362520.t @@ -0,0 +1,43 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +#. $(dirname $0)/../../volume.rc + +cleanup; + +#Basic checks +TEST glusterd +TEST pidof glusterd +TEST $CLI volume info + +#Create a distributed volume +TEST $CLI volume create $V0 $H0:$B0/${V0}{1}; +TEST $CLI volume start $V0 + +# Mount FUSE without selinux: +TEST glusterfs -s $H0 --volfile-id $V0 $@ $M0 + +#Get the client log file +log_wd=$(gluster --print-logdir) +log_id=${M0:1} # Remove initial slash +log_id=${log_id//\//-} # Replace remaining slashes with dashes +log_file=$log_wd/$log_id.log + +#Set the client xlator log-level to TRACE and check if the TRACE logs get +#printed +TEST setfattr -n trusted.glusterfs.$V0-client-0.set-log-level -v TRACE $M0 +TEST ! stat $M0/xyz +grep -q " T \[rpc-clnt\.c" $log_file +res=$? +EXPECT '0' echo $res + +#Set the client xlator log-level to INFO and make sure the TRACE logs do +#not get printed +echo > $log_file +TEST setfattr -n trusted.glusterfs.$V0-client-0.set-log-level -v INFO $M0 +TEST ! stat $M0/xyz +grep -q " T \[rpc-clnt\.c" $log_file +res=$? +EXPECT_NOT '0' echo $res + +cleanup; -- cgit