diff --git a/code/zato-common/src/zato/common/util/logging_.py b/code/zato-common/src/zato/common/util/logging_.py index f1d2718d1..b620a910f 100644 --- a/code/zato-common/src/zato/common/util/logging_.py +++ b/code/zato-common/src/zato/common/util/logging_.py @@ -7,6 +7,7 @@ """ # stdlib +import os from logging import Formatter # Zato @@ -112,7 +113,7 @@ class: {log_handler_class} filename: './logs/server.log' mode: 'a' - maxBytes: 20000000 + maxBytes: {server_log_max_size} backupCount: 10 encoding: 'utf8' stdout: @@ -120,7 +121,7 @@ class: logging.StreamHandler stream: ext://sys.stdout http_access_log: - formatter: http_access_log + formatter: {server_log_max_size} class: {log_handler_class} filename: './logs/http_access.log' mode: 'a' @@ -172,7 +173,7 @@ class: {log_handler_class} filename: './logs/pubsub.log' mode: 'a' - maxBytes: 20000000 + maxBytes: {server_log_max_size} backupCount: 10 encoding: 'utf8' pubsub_overflow: @@ -180,7 +181,7 @@ class: {log_handler_class} filename: './logs/pubsub-overflow.log' mode: 'a' - maxBytes: 200000000 + maxBytes: {server_log_max_size} backupCount: 50 encoding: 'utf8' pubsub_audit: @@ -188,7 +189,7 @@ class: {log_handler_class} filename: './logs/pubsub-audit.log' mode: 'a' - maxBytes: 200000000 + maxBytes: {server_log_max_size} backupCount: 50 encoding: 'utf8' rbac: @@ -212,7 +213,7 @@ class: {log_handler_class} filename: './logs/web_socket.log' mode: 'a' - maxBytes: 20000000 + maxBytes: {server_log_max_size} backupCount: 10 encoding: 'utf8' ibm_mq: @@ -305,7 +306,16 @@ def get_logging_conf_contents() -> 'str': # Under Windows, we cannot have multiple processes access the same log file log_handler_class = linux_log_handler_class if is_linux else non_linux_log_handler_class - return logging_conf_contents.format(log_handler_class=log_handler_class) + # This can be overridden by users + if server_log_max_size := os.environ.get('Zato_Server_Log_Max_Size'): + server_log_max_size = int(server_log_max_size) + else: + server_log_max_size = 1000000000 # 1 GB by default + + return logging_conf_contents.format( + log_handler_class=log_handler_class, + server_log_max_size=server_log_max_size, + ) # ################################################################################################################################ # ################################################################################################################################