Rayjas Logging

"Only a life lived for others is a life worthwhile." – Albert Einstein

Just as with a lot of other programs, rayjas has its own log files, wherein it writes about events, actions & errors that take place in its execution. The log files are the first point of inspection in case of execution issues. Rayjas generates two log files – rayjas.log and errors.log in the log directory of the dist for generic information logging and critical error messages respectively. Both files are located at the rayjas program root. The separation of the two files helps track down errors and events more efficiently.

Logging configuration – logging.json


{
    "version": 1,
    "disable_existing_loggers": false,
    "formatters": {
        "simple": {
            "format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
        }
    },

    "handlers": {
        "console": {
            "class": "logging.StreamHandler",
            "level": "DEBUG",
            "formatter": "simple",
            "stream": "ext://sys.stdout"
        },

        "info_file_handler": {
            "class": "logging.handlers.RotatingFileHandler",
            "level": "INFO",
            "formatter": "simple",
            "filename": "rayjas.log",
            "maxBytes": 20971520,
            "backupCount": 10,
            "encoding": "utf8"
        },

        "error_file_handler": {
            "class": "logging.handlers.RotatingFileHandler",
            "level": "ERROR",
            "formatter": "simple",
            "filename": "errors.log",
            "maxBytes": 20971520,
            "backupCount": 10,
            "encoding": "utf8"
        }
    },


    "root": {
        "level": "INFO",
        "handlers": ["console", "info_file_handler", "error_file_handler"]
    }
}

Configuration Properties


AttributeDescriptionValue TypeDefault Value
root
root.levelSets the default logging level for the entire applicationINFO/DEBUG/
WARN
INFO
root.handlersAn array of different logging handler configurations
formatters
formatters.simpleDefault log statement formatter
formatters.simple.formatExpression for default log formatter%(asctime)s – %(name)s – %(levelname)s – %(message)s
handlers
handlers.info_file_handlerHandler configuration for info/debug/warn logging
handlers.error_file_handlerHandler configuration for error logging