Added logging support. Logging behaviour can be set in logging.conf.
Logs that are sent to files are formatted as JSON.