Commit 3b1f7b79 authored by juga  's avatar juga
Browse files

minor: Change info logs to debug or warning

when they contain sensitive information, eg. Web server or are too
verbose for the debug level.
Also add log to indicate when the main loop is actually started.
parent 4e7ad5d7
......@@ -377,7 +377,7 @@ def measure_relay(args, conf, destinations, cb, rl, relay):
# always fail when there's only one Web server.
if not is_usable and \
relay.is_exit_not_bad_allowing_port(dest.port):
log.info(
log.debug(
"Exit %s (%s) that can't exit all ips, with exit policy %s, failed"
" to connect to %s via circuit %s (%s). Reason: %s. Trying again "
"with it as entry.", relay.fingerprint, relay.nickname,
......@@ -575,6 +575,7 @@ def main_loop(args, conf, controller, relay_list, circuit_builder, result_dump,
measured.
"""
log.info("Started the main loop to measure the relays.")
hbeat = Heartbeat(conf.getpath('paths', 'state_fname'))
# Set the time to wait for a thread to finish as the half of an HTTP
......
......@@ -207,12 +207,12 @@ class Destination:
self._delta_seconds_retry *= factor or self._factor
if self._delta_seconds_retry > self._max_seconds_between_retries:
self._delta_seconds_retry = self._max_seconds_between_retries
log.info("Incremented the time to try destination %s past the "
log.debug("Incremented the time to try destination %s past the "
"limit, capping it at %s hours.",
self.url, self._delta_seconds_retry / 60 / 60)
else:
log.info("Incremented the time to try destination %s to %s hours.",
self.url, self._delta_seconds_retry / 60 / 60)
log.debug("Incremented the time to try destination %s to %s "
"hours.", self.url, self._delta_seconds_retry / 60 / 60)
def _get_last_try_in_seconds_ago(self):
"""
......@@ -250,21 +250,27 @@ class Destination:
# Failed the last X consecutive times
if self._are_last_attempts_failures():
# The log here will appear in all the the queued
# relays and threads.
log.warning("The last %s times the destination %s failed. "
# The log here will appear in all the the queued relays and
# threads.
log.debug("The last %s times the destination %s failed. "
"It last ran %s seconds ago. "
"Disabled for %s seconds.",
self._max_num_failures, self.url,
self._get_last_try_in_seconds_ago(),
self._delta_seconds_retry)
log.warning("Please, add more destinations or increment the "
log.warning("The last %s times a destination failed. "
"It last ran %s seconds ago. "
"Disabled for %s seconds."
"Please, add more destinations or increment the "
"number of maximum number of consecutive failures "
"in the configuration.")
"in the configuration.",
self._max_num_failures,
self._get_last_try_in_seconds_ago(),
self._delta_seconds_retry)
# It was not used for a while and the last time it was used
# was long ago, then try again
if self._is_last_try_old_enough():
log.info("The destination %s was not tried for %s seconds, "
log.debug("The destination %s was not tried for %s seconds, "
"it is going to by tried again.", self.url,
self._get_last_try_in_seconds_ago())
# Set the next time to retry higher, in case this attempt fails
......
......@@ -799,14 +799,17 @@ class ResultDump:
msg += ". As exit." if as_exit else ". As entry."
# When the error is that there are not more functional destinations.
if result.type == "error-destination":
log.info("Shutting down because there are not functional "
log.warning("Shutting down because there are not functional "
"destinations.")
# NOTE: Because this is executed in a thread, stop_threads can not
# be call from here, it has to be call from the main thread.
# Instead set the singleton end event, that will call stop_threads
# from the main process.
settings.end_event.set()
log.info(msg)
# log every success/error measurement at debug level, to don't log the
# the Web server at info level and because there's already a
# heartbeat msg to indicate progress.
log.debug(msg)
def enter(self):
"""Main loop for the ResultDump thread.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment