Skip to content

Commit

Permalink
Improve the debug formatting of startup logging messages.
Browse files Browse the repository at this point in the history
This patch uses pformat to nicely print the various startup dicts for ease of reading.

	modified:   scripts/dirac-daemon.py
	modified:   scripts/monitoring-daemon.py
	modified:   scripts/userdb-update.py
	modified:   scripts/webapp-daemon.py
  • Loading branch information
alexanderrichards committed Apr 17, 2019
1 parent 812e33b commit 2eb725d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
9 changes: 5 additions & 4 deletions scripts/dirac-daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import logging
from logging.handlers import TimedRotatingFileHandler
from itertools import chain
from pprint import pformat
import pkg_resources
import psutil
import mock
Expand Down Expand Up @@ -201,11 +202,11 @@ def start(args):

# setup the main app logger
logger = logging.getLogger(app_name)
logger.debug("Script called with args: %s", cli_args)
logger.debug("Script called with args:\n%s", pformat(cli_args))
if config_path is None:
logger.warning("Config file '%s' does not exist", cli_args['config'])
logger.debug("Active config looks like: %s", config_instance.config)
logger.debug("Runtime args: %s", args)
logger.debug("Active config looks like:\n%s", pformat(config_instance.config))
logger.debug("Runtime args:\n%s", pformat(vars(args)))

# Entry Point Setup
###########################################################################
Expand All @@ -218,7 +219,7 @@ def start(args):
for group, map in entry_point_map.iteritems():
map.update(pkg_resources.get_entry_map(args.extension, group))
config_instance.entry_point_map = entry_point_map
logger.debug("Starting with entry point map: %s", entry_point_map)
logger.debug("Starting with entry point map:\n%s", pformat(entry_point_map))

# Enact the subcommand
###########################################################################
Expand Down
9 changes: 5 additions & 4 deletions scripts/monitoring-daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import logging
from logging.handlers import TimedRotatingFileHandler
from itertools import chain
from pprint import pformat
import pkg_resources
import psutil

Expand Down Expand Up @@ -201,11 +202,11 @@ def start(args):

# setup the main app logger
logger = logging.getLogger(app_name)
logger.debug("Script called with args: %s", cli_args)
logger.debug("Script called with args:\n%s", pformat(cli_args))
if config_path is None:
logger.warning("Config file '%s' does not exist", cli_args['config'])
logger.debug("Active config looks like: %s", config_instance.config)
logger.debug("Runtime args: %s", args)
logger.debug("Active config looks like:\n%s", pformat(config_instance.config))
logger.debug("Runtime args:\n%s", pformat(vars(args)))

# Entry Point Setup
###########################################################################
Expand All @@ -218,7 +219,7 @@ def start(args):
for group, map in entry_point_map.iteritems():
map.update(pkg_resources.get_entry_map(args.extension, group))
config_instance.entry_point_map = entry_point_map
logger.debug("Starting with entry point map: %s", entry_point_map)
logger.debug("Starting with entry point map:\n%s", pformat(entry_point_map))

# Enact the subcommand
###########################################################################
Expand Down
7 changes: 4 additions & 3 deletions scripts/userdb-update.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import logging
import argparse
import importlib
from pprint import pformat
import pkg_resources

from sqlalchemy.exc import SQLAlchemyError
Expand Down Expand Up @@ -68,11 +69,11 @@

# setup the main app logger
logger = logging.getLogger(app_name)
logger.debug("Script called with args: %s", cli_args)
logger.debug("Script called with args:\n%s", pformat(cli_args))
if config_path is None:
logger.warning("Config file '%s' does not exist", cli_args['config'])
logger.debug("Active config looks like: %s", config_instance.config)
logger.debug("Runtime args: %s", args)
logger.debug("Active config looks like:\n%s", pformat(config_instance.config))
logger.debug("Runtime args:\n%s", pformat(vars(args)))

# Entry Point Setup
###########################################################################
Expand Down
9 changes: 5 additions & 4 deletions scripts/webapp-daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import logging
from logging.handlers import TimedRotatingFileHandler
from itertools import chain
from pprint import pformat
import mock
import pkg_resources
import psutil
Expand Down Expand Up @@ -210,11 +211,11 @@ def start(args):

# setup the main app logger
logger = logging.getLogger(app_name)
logger.debug("Script called with args: %s", cli_args)
logger.debug("Script called with args:\n%s", pformat(cli_args))
if config_path is None:
logger.warning("Config file '%s' does not exist", cli_args['config'])
logger.debug("Active config looks like: %s", config_instance.config)
logger.debug("Runtime args: %s", args)
logger.debug("Active config looks like:\n%s", pformat(config_instance.config))
logger.debug("Runtime args:\n%s", pformat(vars(args)))

# Entry Point Setup
###########################################################################
Expand All @@ -227,7 +228,7 @@ def start(args):
for group, map in entry_point_map.iteritems():
map.update(pkg_resources.get_entry_map(args.extension, group))
config_instance.entry_point_map = entry_point_map
logger.debug("Starting with entry point map: %s", entry_point_map)
logger.debug("Starting with entry point map:\n%s", pformat(entry_point_map))

# Enact the subcommand
###########################################################################
Expand Down

0 comments on commit 2eb725d

Please sign in to comment.