If you add LOG_MODE_SHORT_FILELINE, it changes the the following debug
line from:
[/sandbox/lhh/cluster/fence/agents/xvm/fence_xvmd.c:0587] My Node ID = 1
...to:
[fence_xvmd.c:0587] My Node ID = 1
Most developers who insert LOG_DEBUG lines will be able to determine out
of context which source code file a particular log message came from, so
it is arguable the entire path spec is unnecessary (and perhaps
"SHORT_FILELINE" should be the default; but we'll leave that for another
day).
-- Lon
Index: exec/logsys.c
===================================================================
--- exec/logsys.c (revision 1568)
+++ exec/logsys.c (working copy)
@@ -298,6 +298,7 @@
char newstring[4096];
char log_string[4096];
char char_time[512];
+ char *p = NULL;
struct timeval tv;
int i = 0;
int len;
@@ -331,6 +332,11 @@
}
if ((priority == LOG_LEVEL_DEBUG) || (logsys_mode & LOG_MODE_DISPLAY_FILELINE)) {
+ if (logsys_mode & LOG_MODE_SHORT_FILELINE) {
+ p = strrchr(file, '/');
+ if (p)
+ file = ++p;
+ }
sprintf (&newstring[i], "[%s:%04u] %s", file, line, format);
} else {
if (logsys_nosubsys == 1) {
Index: exec/logsys.h
===================================================================
--- exec/logsys.h (revision 1568)
+++ exec/logsys.h (working copy)
@@ -52,6 +52,7 @@
#define LOG_MODE_DISPLAY_TIMESTAMP (1<<7)
#define LOG_MODE_BUFFER_BEFORE_CONFIG (1<<8)
#define LOG_MODE_FLUSH_AFTER_CONFIG (1<<9)
+#define LOG_MODE_SHORT_FILELINE (1<<10)
/*
* Log priorities, compliant with syslog and SA Forum Log spec.
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais