diff options
author | Arne Juul <arnej@yahoo-inc.com> | 2017-09-08 08:05:55 +0000 |
---|---|---|
committer | Arne Juul <arnej@yahoo-inc.com> | 2017-09-08 08:05:55 +0000 |
commit | daadb26ae52c23924ec9c0094e12d7a5d7499a41 (patch) | |
tree | fd645b8002a566033a68c21fbf84d922e46ca0a6 /vespalog | |
parent | 5734bcd664f92dd29f40d3cb8fad85547e6c9fef (diff) |
use Defaults::vespaHostname
Diffstat (limited to 'vespalog')
-rw-r--r-- | vespalog/src/vespa/log/llparser.cpp | 7 | ||||
-rw-r--r-- | vespalog/src/vespa/log/log.cpp | 5 |
2 files changed, 4 insertions, 8 deletions
diff --git a/vespalog/src/vespa/log/llparser.cpp b/vespalog/src/vespa/log/llparser.cpp index d239f291c9f..5e48343dfaf 100644 --- a/vespalog/src/vespa/log/llparser.cpp +++ b/vespalog/src/vespa/log/llparser.cpp @@ -6,15 +6,15 @@ #include <cstdlib> #include <unistd.h> #include <sys/time.h> +#include <vespa/defaults.h> namespace ns_log { static const char *defcomponent = "logger"; static const char *defservice = "-"; -static char defhostname[256] = "localhost"; LLParser::LLParser() - : _defHostname(defhostname), + : _defHostname(vespa::Defaults::vespaHostname()), _defService(defservice), _defComponent(defcomponent), _defLevel(Logger::info), @@ -37,9 +37,6 @@ LLParser::LLParser() delete _target; _target = target; } - if (gethostname(defhostname, 256) == 0) { - _defHostname = defhostname; - } snprintf(_defPid, 10, "%d", (int)getpid()); } diff --git a/vespalog/src/vespa/log/log.cpp b/vespalog/src/vespa/log/log.cpp index a0977406dc0..7d98c22957d 100644 --- a/vespalog/src/vespa/log/log.cpp +++ b/vespalog/src/vespa/log/log.cpp @@ -12,6 +12,7 @@ LOG_SETUP_INDIRECT(".log", "$Id$"); #include "control-file.h" #include "bufferedlogger.h" +#include <vespa/defaults.h> #include <vespa/fastos/thread.h> #include <cassert> #include <cstdarg> @@ -114,9 +115,7 @@ void Logger::ensureHostname() { if (_hostname[0] == '\0') { - char hn[257]; - snprintf(_hostname, sizeof _hostname, "%s", - (gethostname(hn, sizeof hn) == 0) ? hn : "-"); + snprintf(_hostname, sizeof _hostname, "%s", vespa::Defaults::vespaHostname()); } } |