logging and debugging fixes
* optparse values may not be strings, ConfigParser requires strings * forcing DEBUG level should work for all handlers regardless of configuration source (file, command line options)
This commit is contained in:
parent
4212f6dfe0
commit
6b5db413c5
@ -81,10 +81,10 @@ for option in parser.option_list:
|
|||||||
if key:
|
if key:
|
||||||
section = "logging" if key == "debug" else "server"
|
section = "logging" if key == "debug" else "server"
|
||||||
value = getattr(options, key)
|
value = getattr(options, key)
|
||||||
radicale.config.set(section, key, value)
|
radicale.config.set(section, key, str(value))
|
||||||
|
|
||||||
# Start logging
|
# Start logging
|
||||||
radicale.log.start(options.debug)
|
radicale.log.start()
|
||||||
|
|
||||||
# Fork if Radicale is launched as daemon
|
# Fork if Radicale is launched as daemon
|
||||||
if options.daemon:
|
if options.daemon:
|
||||||
|
@ -35,10 +35,8 @@ from radicale import config
|
|||||||
LOGGER = logging.getLogger()
|
LOGGER = logging.getLogger()
|
||||||
FILENAME = os.path.expanduser(config.get("logging", "config"))
|
FILENAME = os.path.expanduser(config.get("logging", "config"))
|
||||||
|
|
||||||
def start(debug=False):
|
def start():
|
||||||
"""Start the logging according to the configuration."""
|
"""Start the logging according to the configuration."""
|
||||||
if debug:
|
|
||||||
LOGGER.setLevel(logging.DEBUG)
|
|
||||||
|
|
||||||
if os.path.exists(FILENAME):
|
if os.path.exists(FILENAME):
|
||||||
# Configuration taken from file
|
# Configuration taken from file
|
||||||
@ -48,3 +46,8 @@ def start(debug=False):
|
|||||||
handler = logging.StreamHandler(sys.stdout)
|
handler = logging.StreamHandler(sys.stdout)
|
||||||
handler.setFormatter(logging.Formatter("%(message)s"))
|
handler.setFormatter(logging.Formatter("%(message)s"))
|
||||||
LOGGER.addHandler(handler)
|
LOGGER.addHandler(handler)
|
||||||
|
|
||||||
|
if config.getboolean("logging", "debug"):
|
||||||
|
LOGGER.setLevel(logging.DEBUG)
|
||||||
|
for handler in LOGGER.handlers:
|
||||||
|
handler.setLevel(logging.DEBUG)
|
||||||
|
Loading…
Reference in New Issue
Block a user