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

Related topics

Topic Replies Views Activity
How to create log file in actions server 3 2.6k Aug 2023
Create logs file every 1 hour? 2 270 Nov 2022
How to retrieve logs from the action server (locally) 3 6.8k Aug 2022
Rasa logs on server want to be separate every 1 hour 2 269 Dec 2023
CLI option –logging-config-file to enable configuration of custom logs formatting doesn’t work 4 1.1k Jan 2023