cmm: Config option to redirect logoutput to stdout
Send log output to stdout if "-" is specified for file name. This allows
us to collect logs via logos in the usual way.
Change-Id: Iaba61fb5ec62927dacef957d48f9457911cf4e4a
diff --git a/cmm/src/ffcontrol.c b/cmm/src/ffcontrol.c
index 37bf8f4..4c38e14 100644
--- a/cmm/src/ffcontrol.c
+++ b/cmm/src/ffcontrol.c
@@ -1022,10 +1022,19 @@
{
if (strcasecmp(buf2, "file") == 0)
{
- globalConf.logFile = fopen(buf3 , "a");
- if (globalConf.logFile)
+ if (strcmp(buf3, "-") == 0)
+ {
+ /* Don't include DEBUG_STDERR if logFile is stdout */
+ globalConf.log_level &= ~DEBUG_STDERR;
+ globalConf.logFile = stdout;
+ }
+ else
{
globalConf.log_level |= DEBUG_STDERR;
+ globalConf.logFile = fopen(buf3 , "a");
+ }
+ if (globalConf.logFile)
+ {
pthread_mutex_init(&globalConf.logMutex, NULL);
setlinebuf(globalConf.logFile);
}