diff --git a/CHANGELOG.md b/CHANGELOG.md index 21aadee9..b30fdc84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ - Setup logging for panel authentication attempts ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/669)) - Update minimum password length from 6 to 8, and unrestrict maximum password length ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/669)) - Give better feedback when backup delete fails ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/681)) +- Add user queue debug logging ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/683)) ### Lang - pl_PL Minor fixes ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/675))

diff --git a/app/classes/shared/tasks.py b/app/classes/shared/tasks.py index ff20e7ec..a5ea32ac 100644 --- a/app/classes/shared/tasks.py +++ b/app/classes/shared/tasks.py @@ -23,6 +23,7 @@ from app.classes.web.tornado_handler import Webserver from app.classes.shared.websocket_manager import WebSocketManager logger = logging.getLogger("apscheduler") +command_log = logging.getLogger("cmd_queue") scheduler_intervals = { "seconds", "minutes", @@ -94,7 +95,15 @@ class TasksManager: def command_watcher(self): while True: # select any commands waiting to be processed + command_log.debug( + "Queue currently has " + f"{self.controller.management.command_queue.qsize()} queued commands." + ) if not self.controller.management.command_queue.empty(): + command_log.info( + "Current queued commands: " + f"{list(self.controller.management.command_queue.queue)}" + ) cmd = self.controller.management.command_queue.get() try: svr = self.controller.servers.get_server_instance_by_id( diff --git a/app/config/logging.json b/app/config/logging.json index 9dd09c81..fd1173eb 100644 --- a/app/config/logging.json +++ b/app/config/logging.json @@ -13,6 +13,9 @@ }, "auth": { "format": "%(asctime)s - [AUTH] - %(levelname)s - %(message)s" + }, + "cmd_queue": { + "format": "%(asctime)s - [CMD_QUEUE] - %(levelname)s - %(message)s" } }, "handlers": { @@ -59,6 +62,14 @@ "maxBytes": 10485760, "backupCount": 20, "encoding": "utf8" + }, + "cmd_queue_file_handler": { + "class": "logging.handlers.RotatingFileHandler", + "formatter": "auth", + "filename": "logs/cmd_queue.log", + "maxBytes": 10485760, + "backupCount": 20, + "encoding": "utf8" } }, "loggers": { @@ -90,6 +101,13 @@ "auth_file_handler" ], "propagate": false + }, + "cmd_queue": { + "level": "INFO", + "handlers": [ + "cmd_queue_file_handler" + ], + "propagate": false } } } \ No newline at end of file