From 116478a3be46abf04ab25ba483b4e86483fb9cb8 Mon Sep 17 00:00:00 2001 From: Colin Patrick McCabe Date: Tue, 7 Dec 2010 18:49:14 -0800 Subject: [PATCH] logging: _calculate_opath: use g_conf.log_dir Signed-off-by: Colin McCabe --- src/common/DoutStreambuf.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/common/DoutStreambuf.cc b/src/common/DoutStreambuf.cc index 282ab0a209f92..469f2c9ece89a 100644 --- a/src/common/DoutStreambuf.cc +++ b/src/common/DoutStreambuf.cc @@ -402,10 +402,18 @@ template std::string DoutStreambuf::_calculate_opath() const { assert(_dout_lock.is_locked()); + + // If g_conf.log_file was specified, that takes the highest priority if (!empty(g_conf.log_file)) { return normalize_relative(g_conf.log_file); } + string log_dir; + if (empty(g_conf.log_dir)) + log_dir = normalize_relative("."); + else + log_dir = normalize_relative(g_conf.log_dir); + if (g_conf.log_per_instance) { char hostname[255]; memset(hostname, 0, sizeof(hostname)); @@ -418,12 +426,12 @@ std::string DoutStreambuf::_calculate_opath() const return ""; } ostringstream oss; - oss << hostname << "." << getpid(); + oss << log_dir << "/" << hostname << "." << getpid(); return oss.str(); } else { ostringstream oss; - oss << g_conf.type << "." << g_conf.id << ".log"; + oss << log_dir << "/" << g_conf.type << "." << g_conf.id << ".log"; return oss.str(); } } -- 2.39.5