Re: [Linux-ha-dev] RA output same log twice to the syslog

2010-02-22 Thread NAKAHIRA Kazutomo

Hi, Dejan

Thank you for your speedy response.

(2010/02/19 21:51), Dejan Muhamedagic wrote:

Hi Kazutomo-san,

On Fri, Feb 19, 2010 at 05:36:36PM +0900, NAKAHIRA Kazutomo wrote:

Hi, all

I noticed that RA output same log twice to the syslog
when Heartbeat uses syslog instead of logd.

-- example of logs --
Feb  4 17:32:16 test-1 sfex[9804]: INFO: sfex_daemon: starting...
Feb  4 17:32:16 test-1 lrmd: [9746]: info: RA output:
(prmExPostgreSQLDB:start:stderr) 2010/02/04_17:32:16 INFO: sfex_daemon:
starting...



Yes, I've noticed this too.


It seems that ha_log() in the .ocf-shellfuncs does not return 0
when logger command succeeded. Is it intended operation?


Probably not though I doubt that anybody's checking the exit code
of ocf_log.


If it is not intended operation, then I suggest attached patch.


Well, the logging has always worked inclusively, i.e. the output
goes according to the all options set (logfacility, logfile,
debugfile). So, your patch would be a regression.

OK, I understand what is wrong.



I'm not sure what is actually sending the log message to stderr.

I think that there is a problem in the feature of outputting the log
to stderr if any value is not set in $HA_LOGFILE($HA_DEBUGLOG).

It is necessary to output the log to stderr when logd is not used, and
the value is not set in $HA_LOGFACILITY and $HA_LOGFILE.
# RA unit testing might correspond to this case.

I re-write patch for ocf-shellfuncs.(Please see attached.)

Best regards,
NAKAHIRA Kazutomo


Thanks,

Dejan


Best regards,
NAKAHIRA Kazutomo



# HG changeset patch
# User NAKAHIRA Kazutomonakahira.kazut...@oss.ntt.co.jp
# Date 1265790964 -32400
# Node ID 47609277982e9dceec81423a24a4e028101bccbe
# Parent  a3db4fe3930158e0a491e8b38b5db37f61eb9505
Prevent double output of ocf_log

diff -r a3db4fe39301 -r 47609277982e heartbeat/.ocf-shellfuncs.in
--- a/heartbeat/.ocf-shellfuncs.in  Mon Feb 08 15:04:09 2010 +0100
+++ b/heartbeat/.ocf-shellfuncs.in  Wed Feb 10 17:36:04 2010 +0900
@@ -181,6 +181,9 @@
  *INFO*|info)  loglevel=info;;
  esac
  logger -t $HA_LOGTAG -p ${HA_LOGFACILITY}.${loglevel} ${*}
+ if [ $? -eq 0 ] ; then
+   return 0
+ fi
  fi
  if
  [ -n $HA_LOGFILE ]
@@ -216,6 +219,9 @@
then
  : logging through syslog
  logger -t $HA_LOGTAG -p ${HA_LOGFACILITY}.debug ${*}
+ if [ $? -eq 0 ] ; then
+   return 0
+ fi
fi
  if
  [ -n $HA_DEBUGLOG ]



___
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


___
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/




# HG changeset patch
# User NAKAHIRA Kazutomo nakahira.kazut...@oss.ntt.co.jp
# Date 1266806137 -32400
# Node ID d2d47076f3cdc7a7d30abb61fe21229ebd624068
# Parent  44b1ba8c78049c3a815f69d878929f7c297f4da6
Prevent double output of ocf_log

diff -r 44b1ba8c7804 -r d2d47076f3cd heartbeat/.ocf-shellfuncs.in
--- a/heartbeat/.ocf-shellfuncs.in  Mon Feb 15 13:07:29 2010 +0100
+++ b/heartbeat/.ocf-shellfuncs.in  Mon Feb 22 11:35:37 2010 +0900
@@ -191,7 +191,11 @@
then
  : appending to $HA_LOGFILE
  echo $HA_LOGTAG: `hadate`${*}  $HA_LOGFILE
-   else
+   fi
+   if
+ [ -z $HA_LOGFACILITY -a -z $HA_LOGFILE ]
+   then
+ : appending to stderr
  echo `hadate`${*} 2
fi
 if
@@ -226,7 +230,11 @@
then
  : appending to $HA_DEBUGLOG
  echo $HA_LOGTAG: `hadate`${*}  $HA_DEBUGLOG
-   else
+   fi
+   if
+ [ -z $HA_LOGFACILITY -a -z $HA_DEBUGLOG ]
+   then
+ : appending to stderr
  echo $HA_LOGTAG: `hadate`${*}:   ${HA_LOGFACILITY} 2
fi
 }
___
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


Re: [Linux-ha-dev] RA output same log twice to the syslog

2010-02-22 Thread Dejan Muhamedagic
Hi Kazutomo-san,

On Mon, Feb 22, 2010 at 05:52:43PM +0900, NAKAHIRA Kazutomo wrote:
 Hi, Dejan
 
 Thank you for your speedy response.
 
 (2010/02/19 21:51), Dejan Muhamedagic wrote:
 Hi Kazutomo-san,
 
 On Fri, Feb 19, 2010 at 05:36:36PM +0900, NAKAHIRA Kazutomo wrote:
 Hi, all
 
 I noticed that RA output same log twice to the syslog
 when Heartbeat uses syslog instead of logd.
 
 -- example of logs --
 Feb  4 17:32:16 test-1 sfex[9804]: INFO: sfex_daemon: starting...
 Feb  4 17:32:16 test-1 lrmd: [9746]: info: RA output:
 (prmExPostgreSQLDB:start:stderr) 2010/02/04_17:32:16 INFO: sfex_daemon:
 starting...
 
 
 Yes, I've noticed this too.
 
 It seems that ha_log() in the .ocf-shellfuncs does not return 0
 when logger command succeeded. Is it intended operation?
 
 Probably not though I doubt that anybody's checking the exit code
 of ocf_log.
 
 If it is not intended operation, then I suggest attached patch.
 
 Well, the logging has always worked inclusively, i.e. the output
 goes according to the all options set (logfacility, logfile,
 debugfile). So, your patch would be a regression.
 OK, I understand what is wrong.
 
 
 I'm not sure what is actually sending the log message to stderr.
 I think that there is a problem in the feature of outputting the log
 to stderr if any value is not set in $HA_LOGFILE($HA_DEBUGLOG).

OK, I finally found the spot thanks to your patch, though it has
all the time been in front of my eyes :)

 It is necessary to output the log to stderr when logd is not used, and
 the value is not set in $HA_LOGFACILITY and $HA_LOGFILE.
 # RA unit testing might correspond to this case.

Yes. Actually, there's probably a better way, as in
glue/lib/stonith/ha_log.sh, i.e. using tty(1) to find out if
we're attached to a terminal and only then output to stderr.
That'd help with ocf-tester too.

 I re-write patch for ocf-shellfuncs.(Please see attached.)

Applied.

Cheers,

Dejan

 Best regards,
 NAKAHIRA Kazutomo
 
 Thanks,
 
 Dejan
 
 Best regards,
 NAKAHIRA Kazutomo
 
 # HG changeset patch
 # User NAKAHIRA Kazutomonakahira.kazut...@oss.ntt.co.jp
 # Date 1265790964 -32400
 # Node ID 47609277982e9dceec81423a24a4e028101bccbe
 # Parent  a3db4fe3930158e0a491e8b38b5db37f61eb9505
 Prevent double output of ocf_log
 
 diff -r a3db4fe39301 -r 47609277982e heartbeat/.ocf-shellfuncs.in
 --- a/heartbeat/.ocf-shellfuncs.in  Mon Feb 08 15:04:09 2010 +0100
 +++ b/heartbeat/.ocf-shellfuncs.in  Wed Feb 10 17:36:04 2010 +0900
 @@ -181,6 +181,9 @@
   *INFO*|info)  loglevel=info;;
   esac
   logger -t $HA_LOGTAG -p ${HA_LOGFACILITY}.${loglevel} ${*}
 + if [ $? -eq 0 ] ; then
 +   return 0
 + fi
   fi
   if
   [ -n $HA_LOGFILE ]
 @@ -216,6 +219,9 @@
 then
   : logging through syslog
   logger -t $HA_LOGTAG -p ${HA_LOGFACILITY}.debug ${*}
 + if [ $? -eq 0 ] ; then
 +   return 0
 + fi
 fi
   if
   [ -n $HA_DEBUGLOG ]
 
 ___
 Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
 http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
 Home Page: http://linux-ha.org/
 
 ___
 Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
 http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
 Home Page: http://linux-ha.org/
 
 
 

 # HG changeset patch
 # User NAKAHIRA Kazutomo nakahira.kazut...@oss.ntt.co.jp
 # Date 1266806137 -32400
 # Node ID d2d47076f3cdc7a7d30abb61fe21229ebd624068
 # Parent  44b1ba8c78049c3a815f69d878929f7c297f4da6
 Prevent double output of ocf_log
 
 diff -r 44b1ba8c7804 -r d2d47076f3cd heartbeat/.ocf-shellfuncs.in
 --- a/heartbeat/.ocf-shellfuncs.inMon Feb 15 13:07:29 2010 +0100
 +++ b/heartbeat/.ocf-shellfuncs.inMon Feb 22 11:35:37 2010 +0900
 @@ -191,7 +191,11 @@
   then
 : appending to $HA_LOGFILE
 echo $HA_LOGTAG: `hadate`${*}  $HA_LOGFILE
 - else
 + fi
 + if
 +   [ -z $HA_LOGFACILITY -a -z $HA_LOGFILE ]
 + then
 +   : appending to stderr
 echo `hadate`${*} 2
   fi
  if
 @@ -226,7 +230,11 @@
   then
 : appending to $HA_DEBUGLOG
 echo $HA_LOGTAG: `hadate`${*}  $HA_DEBUGLOG
 - else
 + fi
 + if
 +   [ -z $HA_LOGFACILITY -a -z $HA_DEBUGLOG ]
 + then
 +   : appending to stderr
 echo $HA_LOGTAG: `hadate`${*}:   ${HA_LOGFACILITY} 2
   fi
  }

 ___
 Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
 http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
 Home Page: http://linux-ha.org/

___
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


Re: [Linux-ha-dev] RA output same log twice to the syslog

2010-02-19 Thread Dejan Muhamedagic
Hi Kazutomo-san,

On Fri, Feb 19, 2010 at 05:36:36PM +0900, NAKAHIRA Kazutomo wrote:
 Hi, all
 
 I noticed that RA output same log twice to the syslog
 when Heartbeat uses syslog instead of logd.
 
 -- example of logs --
 Feb  4 17:32:16 test-1 sfex[9804]: INFO: sfex_daemon: starting...
 Feb  4 17:32:16 test-1 lrmd: [9746]: info: RA output:
 (prmExPostgreSQLDB:start:stderr) 2010/02/04_17:32:16 INFO: sfex_daemon:
 starting...
 

Yes, I've noticed this too.

 It seems that ha_log() in the .ocf-shellfuncs does not return 0
 when logger command succeeded. Is it intended operation?

Probably not though I doubt that anybody's checking the exit code
of ocf_log.

 If it is not intended operation, then I suggest attached patch.

Well, the logging has always worked inclusively, i.e. the output
goes according to the all options set (logfacility, logfile,
debugfile). So, your patch would be a regression.

I'm not sure what is actually sending the log message to stderr.

Thanks,

Dejan

 Best regards,
 NAKAHIRA Kazutomo

 # HG changeset patch
 # User NAKAHIRA Kazutomo nakahira.kazut...@oss.ntt.co.jp
 # Date 1265790964 -32400
 # Node ID 47609277982e9dceec81423a24a4e028101bccbe
 # Parent  a3db4fe3930158e0a491e8b38b5db37f61eb9505
 Prevent double output of ocf_log
 
 diff -r a3db4fe39301 -r 47609277982e heartbeat/.ocf-shellfuncs.in
 --- a/heartbeat/.ocf-shellfuncs.inMon Feb 08 15:04:09 2010 +0100
 +++ b/heartbeat/.ocf-shellfuncs.inWed Feb 10 17:36:04 2010 +0900
 @@ -181,6 +181,9 @@
  *INFO*|info) loglevel=info;;
 esac
 logger -t $HA_LOGTAG -p ${HA_LOGFACILITY}.${loglevel} ${*}
 +   if [ $? -eq 0 ] ; then
 + return 0
 +   fi
  fi   
  if
 [ -n $HA_LOGFILE ]
 @@ -216,6 +219,9 @@
   then
 : logging through syslog
 logger -t $HA_LOGTAG -p ${HA_LOGFACILITY}.debug ${*}
 +   if [ $? -eq 0 ] ; then
 + return 0
 +   fi
   fi
  if
 [ -n $HA_DEBUGLOG ]

 ___
 Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
 http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
 Home Page: http://linux-ha.org/

___
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/