star-bnl / star-sw

Core software for STAR experiment
26 stars 63 forks source link

Disable logging outside of local domain, with no other changes #644

Closed jml985 closed 3 months ago

jml985 commented 3 months ago

Clean version of the pull request disabling DAQ logging when compiling outside of the local domain.

plexoos commented 3 months ago

supersedes #643

genevb commented 2 months ago

This seems to be working OK in DEV. My understanding is that this PR needs to be back-propagated into any in-use libraries. I suggest to tag the following for now, and I'll begin the re-compilations on SDCC. SL23 a/c/d/e/f SL22 a/b/c SL21 c/d

plexoos commented 2 months ago

The patch worked fine with SL23 but there were conflicts with SL22 and SL21 branches. For these branches, I forced the incoming changes over the existing ones. I don't think our CI will be able to catch potential problems with the online code should they happen. If there is a way to test the patched branches before we merge them, please let me know.

jml985 commented 2 months ago

@plexoos What are the conflicts? Are this git conflicts or compile conflicts?

plexoos commented 2 months ago

A conflict when the patch is applied. Here, for example,

diff --git a/StRoot/RTS/src/rtsmakefile.def b/StRoot/RTS/src/rtsmakefile.def
index b22ce170a7..e65f702e75 100755
--- a/StRoot/RTS/src/rtsmakefile.def
+++ b/StRoot/RTS/src/rtsmakefile.def
@@ -372,8 +374,46 @@ endif
 DEFINES = -D_REENTRANT ${RTS_DAQMAN_FLAGS} -DRTS_HOST_NAME=\"${HOST_NAME}\" -DTARGET_SYSTEM=\"${TARGET_SYSTEM}\" -DPROJDIR=\"${PROJDIR}\"  -DINSTALL_SUFFIX=\"${INSTALL_SUFFIX}\" -D${RTS_TYPE} ${HOW} ${HOSTDEFINES} -DRTS_ONLINE

+<<<<<<< HEAD
 BASEFLAGS = -O3 -Wall -pipe -fverbose-asm ${HOSTFLAGS} 
 #BASEFLAGS= -Wall -pipe -fverbose-asm ${HOSTFLAGS} 
+=======
+# Set strict errors in LINUX
+BASEFLAGS = -O3 -Wall -Wno-error=strict-overflow -Wno-error=maybe-uninitialized -Wno-error=unused-label -Wno-error=unused-value -Wno-error=unused-variable -Wno-error=unused-function -Wno-unused-but-set-variable -pipe -fverbose-asm ${HOSTFLAGS}
+
+
+#-O3
+ifneq (${TARGET_SYSTEM}, LINUX)
+     BASEFLAGS = -Wall  -pipe -fverbose-asm ${HOSTFLAGS} 
+endif
+
+ifeq (${HOST_NAME},xvme01.daq.bnl.local) 
+     BASEFLAGS = -O3 -Wall -Wno-error=strict-overflow -Wno-error=unused-label -Wno-error=unused-value -Wno-error=unused-variable -Wno-error=unused-function -Wno-unused-but-set-variable -pipe -fverbose-asm ${HOSTFLAGS}
+endif
+
+# if not compiling on one of the standard domains, then 
+# use the default log destination of std_err
+# if compiling on local domain, write to daqman
+#
+# if compiling somewhere else for writing to daqman these defines
+ifeq (${HOSTDOMAIN},starp.bnl.gov)
+       DEFINES += -DRTS_LOG_DEFAULT_NET
+       DEFINES += -DRTS_ENABLE_LOG
+else ifeq (${HOSTDOMAIN},daq.bnl.local) 
+       DEFINES += -DRTS_LOG_DEFAULT_NET
+       DEFINES += -DRTS_ENABLE_LOG
+else ifeq (${HOSTDOMAIN},daq2.bnl.local)
+       DEFINES += -DRTS_LOG_DEFAULT_NET
+       DEFINES += -DRTS_ENABLE_LOG
+else ifeq (${HOSTDOMAIN},trg.bnl.local)
+       DEFINES += -DRTS_LOG_DEFAULT_NET
+       DEFINES += -DRTS_ENABLE_LOG
+else ifeq (${HOSTDOMAIN},l4.bnl.local)
+       DEFINES += -DRTS_LOG_DEFAULT_NET
+       DEFINES += -DRTS_ENABLE_LOG
+endif
+
+>>>>>>> 2ffb8a419a (Disable logging outside of local domain, with no other changes (#644))
 CCFLAGS  = ${BASEFLAGS} ${USRCCFLAGS}  ${DEFINES} ${INCLUDES} 
 CXXFLAGS = ${BASEFLAGS} ${USRCXXFLAGS} ${DEFINES} ${INCLUDES} 
 CFLAGS   = ${BASEFLAGS} ${USRCFLAGS}   ${DEFINES} ${INCLUDES} 
plexoos commented 2 months ago
diff --git a/StRoot/RTS/src/LOG/rtsLogUnix.c b/StRoot/RTS/src/LOG/rtsLogUnix.c
index c48799c7d8..3083e23858 100755
--- a/StRoot/RTS/src/LOG/rtsLogUnix.c
+++ b/StRoot/RTS/src/LOG/rtsLogUnix.c
@@ -29,7 +29,35 @@ extern "C" {
 volatile int tonkoLogLevel = 2 ;       

+<<<<<<< HEAD
 static char *getCmd(void) ;
+=======
+
+
+
+
+#ifdef RTS_ENABLE_LOG
+#warning "DAQ logging is enabled"
+#ifdef RTS_LOG_DEFAULT_NET
+#warning "DAQ logging defaults to daqman"
+#else
+#warning "DAQ logging defaults to STDERR"
+#endif  /* RTS_LOG_DEFAULT_NET */
+#else
+#warning "DAQ logging is disabled"
+#endif  /* RTS_ENABLE_LOG */
+
+
+#ifdef RTS_ENABLE_LOG
+
+#ifdef RTS_LOG_DEFAULT_NET
+static int output_flag = RTS_LOG_NET ;
+#else
+static int output_flag = RTS_LOG_STDERR ;
+#endif
+
+static const char *getCmd(void) ;
+>>>>>>> 2ffb8a419a (Disable logging outside of local domain, with no other changes (#644))
 static int  odesc = -1 ;
 static int handchange ;
 static FILE *fdesc = 0 ;
@@ -328,9 +355,13 @@ int rtsLogUnix_v(const char *str, ...)
        return 0 ;
 }

+<<<<<<< HEAD

 static char *getCmd(void)
+=======
+static const char *getCmd(void)
+>>>>>>> 2ffb8a419a (Disable logging outside of local domain, with no other changes (#644))
 {
jml985 commented 2 months ago

I don't understand how these patches map on the changes that were made, which were simple. Maybe git has trouble with the ifdefs. There are only 2 files that are part of the offline compile: rtsLog.h and rtsLogUnix.c. It doesn't look like these have changed since 2019 in our repository, so I don't know why this is occurring. In any event the files should override whatever exists. There aren't multiple branches or anything like that to get confused by.

plexoos commented 2 months ago

For the record, the following branches have been patched and tagged respectively (https://github.com/star-bnl/star-sw/pull/644#issuecomment-1932315236):

SL21c_9, SL21d_4 SL22a_2, SL22b_2, SL22c_1 SL23a_1, SL23b_1, SL23c_1, SL23d_2, SL23e_2, SL23f_2