osaf/services/saf/logsv/config/logsv_classes.xml |   5 +-
 osaf/services/saf/logsv/lgs/lgs_imm.c            |  58 +++++++++++++++++++++++-
 2 files changed, 61 insertions(+), 2 deletions(-)


The OpenSAF integrator can either use the log service configuration object or 
the environment
variables to configure the global configuration attributes of the log service.
By default the configuratino object logConfig=1,safApp=safLogService is created.
This patch detects whether user is attempting to configure/use environment 
variables also
when the configuration object exists. If so, a warning category message is 
logged to the syslog.

diff --git a/osaf/services/saf/logsv/config/logsv_classes.xml 
b/osaf/services/saf/logsv/config/logsv_classes.xml
--- a/osaf/services/saf/logsv/config/logsv_classes.xml
+++ b/osaf/services/saf/logsv/config/logsv_classes.xml
@@ -37,7 +37,7 @@
                        <type>SA_UINT32_T</type>
                        <category>SA_RUNTIME</category>
                        <flag>SA_CACHED</flag>
-               </attr>
+                       </attr>
                <attr>
                        <name>saLogStreamLogFullAction</name>
                        <type>SA_UINT32_T</type>
@@ -165,6 +165,9 @@
                </attr>
        </class>
        <class name="OpenSafLogConfig">
+<!-- Care is needed when changing to the default values for the attributes of 
this class
+to ensure that default global values in the implementation are also changed 
accordingly.
+--> 
                <category>SA_CONFIG</category>
                <rdn>
                        <name>logConfig</name>
diff --git a/osaf/services/saf/logsv/lgs/lgs_imm.c 
b/osaf/services/saf/logsv/lgs/lgs_imm.c
--- a/osaf/services/saf/logsv/lgs/lgs_imm.c
+++ b/osaf/services/saf/logsv/lgs/lgs_imm.c
@@ -84,6 +84,9 @@ typedef struct {
 /* LOG configuration */
 /* Default values are used if no configuration object can be found in IMM */
 /* See function lgs_imm_logconf_get */
+/* Note: These values should be the same as the values defined as "default"
+ * values in the logConfig class definition.
+ */
 static lgs_conf_t _lgs_conf = {
        .logRootDirectory = "",
        .logMaxLogrecsize = 1024,
@@ -1990,6 +1993,52 @@ static void read_logsv_config_environ_va
        TRACE_LEAVE();
 }
 
+/* The function is called when the LOG config object exists,
+ * to determine if envrionment variables also are configured.
+ * If environment variables are also found, then the function
+ * logs a warning message to convey that the environment variables
+ * are ignored when the log config object is also configured.
+ @ param none
+ @ return none
+ */
+
+void check_environs_for_configattribs(void)
+{
+
+       /* If environment variables are configured then, print a warning
+        * message to syslog.
+        */
+       if (getenv("LOGSV_MAX_LOGRECSIZE") != NULL) {
+               LOG_WA("Log Configuration object '%s' exists", 
LGS_IMM_LOG_CONFIGURATION); 
+               LOG_WA("Ignoring environment variable LOGSV_MAX_LOGRECSIZE");
+       }
+       
+       if (getenv("LOG_STREAM_SYSTEM_HIGH_LIMIT") != NULL) {
+               LOG_WA("Log Configuration object '%s' exists", 
LGS_IMM_LOG_CONFIGURATION); 
+               LOG_WA("Ignoring environment variable 
LOG_STREAM_SYSTEM_HIGH_LIMIT");
+       }       
+
+       if (getenv("LOG_STREAM_SYSTEM_LOW_LIMIT") != NULL) {
+               LOG_WA("Log Configuration object '%s' exists", 
LGS_IMM_LOG_CONFIGURATION); 
+               LOG_WA("Ignoring environment variable 
LOG_STREAM_SYSTEM_LOW_LIMIT");
+       }
+       
+       if (getenv("LOG_STREAM_APP_HIGH_LIMIT") != NULL) {
+               LOG_WA("Log Configuration object '%s' exists", 
LGS_IMM_LOG_CONFIGURATION); 
+               LOG_WA("Ignoring environment variable 
LOG_STREAM_APP_HIGH_LIMIT");
+       }
+       
+       if (getenv("LOG_STREAM_APP_LOW_LIMIT") != NULL) {
+               LOG_WA("Log Configuration object '%s' exists", 
LGS_IMM_LOG_CONFIGURATION); 
+               LOG_WA("Ignoring environment variable 
LOG_STREAM_APP_LOW_LIMIT");
+       }
+       
+       if (getenv("LOG_MAX_APPLICATION_STREAMS") != NULL) {
+               LOG_WA("Log Configuration object '%s' exists", 
LGS_IMM_LOG_CONFIGURATION); 
+               LOG_WA("Ignoring environment variable 
LOG_MAX_APPLICATION_STREAMS");
+       }
+}
+
 /**
  * Get log service configuration parameter. See SaLogConfig class.
  * The configuration will be read from IMM. If no config object exits
@@ -2021,8 +2070,15 @@ const void *lgs_imm_logconf_get(lgs_logc
        if (lgs_conf->logInitiated != true) {
                if (read_logsv_config_obj(LGS_IMM_LOG_CONFIGURATION, 
lgs_conf_p) != SA_AIS_OK) {
                        LOG_NO("No or invalid log service configuration 
object");
-                       read_logsv_config_environ_var( lgs_conf_p);
+                       read_logsv_config_environ_var(lgs_conf_p);
+               } else {
+                       /* LGS_IMM_LOG_CONFIGURATION object exists.
+                        * If environment variables exists, then ignore them
+                        * and log a message to syslog.
+                        */
+                               check_environs_for_configattribs();
                }
+               
                lgs_conf_p->logInitiated = true;
        }
 

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to