What I’m trying to do:
Prior to upgrading to 1.13.2 (we were on 1.10.1) we set up our logging to stdout, which added our messages to the log. Since upgrading to 1.13.2, we are not seeing any of these messages making it to the log
What I’ve tried and what’s not working:
Below is an example of what worked previously, but no longer does:
Code Sample:
In a server module:
import logging
logger = logging.getLogger('server')
handler = logging.StreamHandler(sys.stdout)
logger.addHandler(handler)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(filename)s: %(message)s')
handler.setFormatter(formatter)
@anvil.server.callable(require_user=True)
def log_warning(message):
"""Only callable from the server code"""
if logger.isEnabledFor(logging.WARNING):
sanitized_message = sanitize_log_message(message)
logger.warning(get_log_tag() + sanitized_message)
The app server is started like this:
anvil-app-server --config-file app_config.yaml >> /deploy/application/logs/frontend.log 2>&1 &
Previously, this would log information out to the frontend.log, but it no longer does. I presume that logging changed since 1.10.1
Is there a way to have our logging included in the general output (because the logs that anvil produces are valuable, and we’d like them all in the same place)?