Setting log rotation for action server logs is not working in CALM - Rasa CALM - Rasa Community Forum
👋 Introducing the Rasa Playground
Setting log rotation for action server logs is not working in CALM
post by geeta.m.desai on Sep 18, 2024
In my config.yml I have this configuration for log rotation of action server logs. But log file not getting created at all.
logging:
version: 1
disable_existing_loggers: True
formatters:
file_formatter:
format: ‘%(asctime)s - %(name)s - %(levelname)s - %(message)s’
handlers:
action_file_handler:
class: logging.handlers.TimedRotatingFileHandler
filename: actions.log # Log file name
when: ‘midnight’ # Rotate daily
interval: 1 # Rotate every 1 day
backupCount: 7 # Keep 7 days of logs
formatter: file_formatter
root:
level: INFO
handlers: [action_file_handler]
post by jtrasa on Sep 18, 2024
How are you starting your assistant? You need to specify the log config file on the command line with the --logging-config-file option, e.g.:
rasa inspect --logging-config-file logging.yml
For other command-line options, use the --help option, for example rasa --help or rasa inspect --help.
post by geeta.m.desai on Sep 19, 2024
I have shell script for that
#!/bin/bash
python3 set_rasa_env.py
export $(cat .env | xargs)
if [ "$ENV" == "development" ]
then
export MONGODB_URI="mongodb+srv://${MONGODB_USER}:${MONGODB_PASS}${MONGODB_CLUSTER_LOCAL}"
else
export MONGODB_URI="mongodb+srv://${MONGODB_USER}:${MONGODB_PASS}${MONGODB_CLUSTER}"
fi
rasa run actions --debug --logging-config-file logging.yml
and my logging.yml looks like
version: 1
logging:
version: 1
disable_existing_loggers: False
formatters:
file_formatter:
format: ‘%(asctime)s - %(name)s - %(levelname)s - %(message)s’
handlers:
action_file_handler:
class: logging.handlers.TimedRotatingFileHandler
filename: actions.log # Log file name
when: ‘midnight’ # Rotate daily
interval: 1 # Rotate every 1 day
backupCount: 7 # Keep 7 days of logs
formatter: file_formatter
root:
level: INFO
handlers: [action_file_handler]
and my action start script gets stuck like this
(venv) geetadesai@MacBook-Pro rasa-calm % ./scripts/startup/start_rasa_action_server.sh
.env file loaded successfully
2024-09-19 14:37:03 INFO root - .env file loaded successfully
...
If I remove logging parameter server starts fine but still log file is not created
post by geeta.m.desai on Sep 19, 2024
I solved it by adding proper loggers for rasa_sdk.executor, rasa_sdk.endpoint etc. separately. Thank you