[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 20000919: LDM code modification change request



>cc: address@hidden,
>cc: address@hidden
>From: Wayne Gibson <address@hidden>
>Subject: Re: 20000919: ROUTE PostProcessing setup at Oregon State (cont.)
>Organization: Oregon State University
>Keywords: 200009142249.e8EMnCb02002 LDM ldm-mcidas batch.k

Wayne,

Please find appended a patch to ulog/ulog.c from the sources for LDM
version 5.1.2, though this should also work for version 5.0.8 since
ulog.c has not changed recently. The patch just adds a single
block of code to the openulog() function in ulog.c.

If you rebuild the LDM with this patch, it should allow you to
override the syslog facility used by the LDM, by setting the
environment variable ULOG_FACILITY_OVERRIDE.  For example, to use
LOG_LOCAL1 instead of LOG_LOCAL0 for LDM programs, you would set the
environment variable as follows in the .cshrc file of the ldm user

 setenv ULOG_FACILITY_OVERRIDE 1

You would also have to manually edit the scour script to replace
"local0" with "local1" and change /etc/syslog.conf to use "local1"
instead of "local0" for ldm logging.  To see the change, you'd have to
stop, newlog, and start the LDM using ldmadmin.

At your convenience, if you have time to try this we'd be interested
to hear whether it works OK for you.  We'll probably include it in a
future release, as well as changes to the scour script to detect and
use the environment variable too.

--Russ

_____________________________________________________________________

Russ Rew                                         UCAR Unidata Program
address@hidden                     http://www.unidata.ucar.edu

===================================================================
RCS file: /upc/share/CVS/ldm5/ulog/ulog.c,v
retrieving revision 1.87
diff -c -r1.87 ulog.c
*** ulog.c      1999/04/03 01:35:52     1.87
--- ulog.c      2000/09/20 21:05:06
***************
*** 141,146 ****
--- 141,148 ----
   *  Always attempts to open the log connection if there is none,
   *  even if the LOG_NDELAY option bit is cleared.
   *  Returns the descriptor (socket) of the logger or -1 on system call error.
+  *  If ULOG_FACILITY_OVERRIDE environment variable is set, overrides facility.
+  * 
   * N.B. multiple calls without an intervening 'closeulog()' simply 
reinitialize
   * ident, options, and facility.
   * The data referred to by 'ident' and 'filename' should have process 
lifetime.
***************
*** 155,160 ****
--- 157,201 ----
        setulogident(ident);
  
        logOptions = options;
+ 
+       /*
+        * Check the environment for overriding facility.
+        */
+       {
+                 int facility_level = 0;
+               const char *ufo = getenv("ULOG_FACILITY_OVERRIDE");
+               if(ufo != NULL) {
+                 facility_level = atoi(ufo);
+                 switch (facility_level) {
+                 case 0:
+                   facility = LOG_LOCAL0;
+                   break;
+                 case 1:
+                   facility = LOG_LOCAL1;
+                   break;
+                 case 2:
+                   facility = LOG_LOCAL2;
+                   break;
+                 case 3:
+                   facility = LOG_LOCAL3;
+                   break;
+                 case 4:
+                   facility = LOG_LOCAL4;
+                   break;
+                 case 5:
+                   facility = LOG_LOCAL5;
+                   break;
+                 case 6:
+                   facility = LOG_LOCAL6;
+                   break;
+                 case 7:
+                   facility = LOG_LOCAL7;
+                   break;
+                 default:
+                   break;
+                 }
+               }
+       }
  
        if (facility != 0 && (facility &~ LOG_FACMASK) == 0)
                logFacility = facility;