[openib-general] RE: [PATCH] opensm: handle stdout and stderr in osm_log

Eitan Zahavi eitan at mellanox.co.il
Wed Apr 26 23:35:01 PDT 2006


Looks like a good idea to me.

Eitan Zahavi
Design Technology Director
Mellanox Technologies LTD
Tel:+972-4-9097208
Fax:+972-4-9593245
P.O. Box 586 Yokneam 20692 ISRAEL


> -----Original Message-----
> From: Sasha Khapyorsky [mailto:sashak at voltaire.com]
> Sent: Thursday, April 27, 2006 1:16 AM
> To: Hal Rosenstock
> Cc: openib-general at openib.org; Eitan Zahavi; Yael Kalka; Ofer Gigi
> Subject: [PATCH] opensm: handle stdout and stderr in osm_log
> 
> Hello Hal,
> 
> There is small patch for osm_log, this provide possibility to drop log
> output to stdout or stderr.
> 
> Sasha.
> 
> 
> Handle in osm_log "stdout" or "stderr" words as log file names to
> indicate logging to stdout or stderr respectively.
> 
> Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
> ---
> 
>  osm/include/opensm/osm_log.h |    6 +++++-
>  osm/opensm/main.c            |    6 +-----
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/osm/include/opensm/osm_log.h
b/osm/include/opensm/osm_log.h
> index 8cf8cf1..4a7c08c 100644
> --- a/osm/include/opensm/osm_log.h
> +++ b/osm/include/opensm/osm_log.h
> @@ -224,10 +224,14 @@ osm_log_init(
>    p_log->level = log_flags;
>    p_log->flush = flush;
> 
> -  if (log_file == NULL)
> +  if (log_file == NULL || !strcmp(log_file, "stdout"))
>    {
>      p_log->out_port = stdout;
>    }
> +  else if (!strcmp(log_file, "stderr"))
> +  {
> +    p_log->out_port = stderr;
> +  }
>    else
>    {
>      if (accum_log_file)
> diff --git a/osm/opensm/main.c b/osm/opensm/main.c
> index 6f2a857..d95c314 100644
> --- a/osm/opensm/main.c
> +++ b/osm/opensm/main.c
> @@ -722,11 +722,7 @@ #endif
>        break;
> 
>      case 'f':
> -      if (!strcmp(optarg, "stdout"))
> -        /* output should be to standard output */
> -        opt.log_file = NULL;
> -      else
> -        opt.log_file = optarg;
> +      opt.log_file = optarg;
>        break;
> 
>      case 'e':



More information about the general mailing list