Page 1 of 1

[SOLVED] Maybe bug in xrctl's handling of uselogger / logger

PostPosted: Tue Oct 13, 2009 12:38 am
by thehobbit
Unless I'm missing something, I don't believe it's possible to get the "xr-${service}" tag into logger at all:

Code: Select all
my $logger = find_bin($default_logger);
if (istrue($sysconf{uselogger}) and defined($logger)) {
   if ($logger eq 'logger') {
      return ("|$logger -t 'xr-$service'");
   } else {
      return ("|$logger");
   }


It looks like find_bin() either returns undef, or a full path to a $default_logger (in my case, /usr/bin/logger), so the comparison against 'logger' is always false. Perhaps this should be changed to check $default_logger instead of $logger, and to allow substitution in arbitrary $logger commands of the string "{service}"?
Code: Select all
--- xrctl.a     2009-10-12 15:27:49.000000000 -0700
+++ xrctl.b     2009-10-12 15:35:31.000000000 -0700
@@ -398,9 +398,10 @@
     my $service = shift;
     my $logger = find_bin($default_logger);
     if (istrue($sysconf{uselogger}) and defined($logger)) {
-       if ($logger eq 'logger') {
+       if ($default_logger eq 'logger') {
            return ("|$logger -t 'xr-$service'");
        } else {
+           $logger =~ s/\{service\}/$service/g;
            return ("|$logger");
        }
     } else {

PostPosted: Wed Oct 14, 2009 1:25 pm
by Karel
Hi Hobbit,

you're sooo right - your fix is literally in the new version, see also http://xrforum.org/viewtopic.php?t=498.
Thanks for reporting this and figuring it all out!

/Karel

PostPosted: Wed Oct 14, 2009 11:06 pm
by thehobbit
Karel wrote:Hi Hobbit,

you're sooo right - your fix is literally in the new version, see also http://xrforum.org/viewtopic.php?t=498.
Thanks for reporting this and figuring it all out!

/Karel


Thank you for getting it fixed so quickly.