From 1d0d6bd18c5110313ecaed9cc246172fa44a528e Mon Sep 17 00:00:00 2001 From: "Paul J. Davis" Date: Mon, 23 Dec 2013 11:15:36 -0600 Subject: [PATCH] Fix logging when no rsyslog host is configured The call to `inet:getaddr/2` will return a valid IP on `*.cloudant.com` hosts due to our DNS configuration. This avoids the entire call when we have not configured a syslog host. This change was motivated by Jenkins which wasn't logging during `make check` runs. BugzId: 26411 --- src/twig_event_handler.erl | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/twig_event_handler.erl b/src/twig_event_handler.erl index 01e2853..9aa78d7 100644 --- a/src/twig_event_handler.erl +++ b/src/twig_event_handler.erl @@ -64,11 +64,16 @@ handle_call({set_level, Level}, State) -> {ok, ok, State#state{level = Level}}; handle_call(load_config, State) -> - Host = case inet:getaddr(get_env(host, undefined), inet) of - {ok, Address} -> - Address; - {error, _} -> - undefined + Host = case get_env(host, undefined) of + undefined -> + undefined; + SyslogHost -> + case inet:getaddr(SyslogHost, inet) of + {ok, Address} -> + Address; + {error, _} -> + undefined + end end, NewState = State#state{ host = Host,