From 8c8bb43d8204fda822327a83016edeefbe38bdc2 Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Wed, 2 Mar 2016 23:45:25 +0100 Subject: [PATCH] feature #4097: Message format conform 4.x series --- src/log/Log.cc | 12 +++++++----- src/nebula/Nebula.cc | 26 +++++++++++++------------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/log/Log.cc b/src/log/Log.cc index d5a3136389..de92d0cae6 100644 --- a/src/log/Log.cc +++ b/src/log/Log.cc @@ -112,7 +112,7 @@ StdLog::StdLog(const MessageType level, int oid, { ostringstream oss; - oss << "[" << PoolObjectSQL::type_to_str(obj_type) << " " << oid << "] "; + oss << "[" << PoolObjectSQL::type_to_str(obj_type) << " " << oid << "]"; resource_label = oss.str(); } @@ -140,10 +140,11 @@ void StdLog::log( str[24] = '\0'; std::clog << str << " " + << resource_label << "[Z"<< zone_id<< "]" << "[" << module << "]" << "[" << error_names[type] << "]: " - << resource_label << message << endl; + << message << endl; std::clog.flush(); } @@ -172,7 +173,7 @@ SysLog::SysLog(const MessageType level, int oid, { ostringstream oss; - oss << "[" << PoolObjectSQL::type_to_str(obj_type) << " " << oid << "] "; + oss << "[" << PoolObjectSQL::type_to_str(obj_type) << " " << oid << "]"; resource_label = oss.str(); } @@ -194,10 +195,11 @@ void SysLog::log( { ostringstream oss; - oss << "[Z"<< zone_id<< "]" + oss << resource_label + << "[Z"<< zone_id<< "]" << "[" << module << "]" << "[" << error_names[type] << "]: " - << resource_label << line; + << line; syslog(slevel, oss.str().c_str()); } diff --git a/src/nebula/Nebula.cc b/src/nebula/Nebula.cc index ff2970066a..c833069b96 100644 --- a/src/nebula/Nebula.cc +++ b/src/nebula/Nebula.cc @@ -377,25 +377,25 @@ void Nebula::start(bool bootstrap_only) // ----------------------------------------------------------- // Close stds, we no longer need them // ----------------------------------------------------------- - - fd = open("/dev/null", O_RDWR); - - dup2(fd,0); - if (NebulaLog::log_type() != NebulaLog::STD ) { + fd = open("/dev/null", O_RDWR); + + dup2(fd,0); dup2(fd,1); dup2(fd,2); + + close(fd); + + fcntl(0, F_SETFD, 0); // Keep them open across exec funcs + fcntl(1, F_SETFD, 0); + fcntl(2, F_SETFD, 0); } - - close(fd); - - fcntl(0,F_SETFD,0); // Keep them open across exec funcs - - if (NebulaLog::log_type() != NebulaLog::STD ) + else { - fcntl(1,F_SETFD,0); - fcntl(2,F_SETFD,0); + fcntl(0, F_SETFD, FD_CLOEXEC); + fcntl(1, F_SETFD, FD_CLOEXEC); + fcntl(2, F_SETFD, FD_CLOEXEC); } // -----------------------------------------------------------