diff --git a/CHANGELOG.md b/CHANGELOG.md index 93b51220..bca7c66b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -76,6 +76,7 @@ v1.6.0 - unreleased - Enhancement: Move Mailu Docker network to a fixed subnet ([#727](https://github.com/Mailu/Mailu/issues/727)) - Enhancement: Added regex validation for alias username ([#764](https://github.com/Mailu/Mailu/issues/764)) - Enhancement: Update documentation +- Enhancement: Add logging at critical places in python start.py scripts. Implement LOG_LEVEL to controll verbosity ([#588](https://github.com/Mailu/Mailu/issues/588)) - Upstream: Update Roundcube - Upstream: Update Rainloop - Bug: Rainloop fails with "domain not allowed" ([#93](https://github.com/Mailu/Mailu/issues/93)) diff --git a/core/dovecot/start.py b/core/dovecot/start.py index 68043cd1..b4289b76 100755 --- a/core/dovecot/start.py +++ b/core/dovecot/start.py @@ -12,7 +12,7 @@ import sys from tenacity import retry from podop import run_server -log.basicConfig(stream=sys.stderr, level=os.environ["LOG_LEVEL"] if "LOG_LEVEL" in os.environ else "WARN") +log.basicConfig(stream=sys.stderr, level=os.environ["LOG_LEVEL"] if "LOG_LEVEL" in os.environ else "WARNING") def start_podop(): os.setuid(8) diff --git a/core/nginx/config.py b/core/nginx/config.py index 719a6450..528a3247 100755 --- a/core/nginx/config.py +++ b/core/nginx/config.py @@ -7,7 +7,7 @@ import sys args = os.environ.copy() -log.basicConfig(stream=sys.stderr, level=args["LOG_LEVEL"] if "LOG_LEVEL" in args else "WARN") +log.basicConfig(stream=sys.stderr, level=args["LOG_LEVEL"] if "LOG_LEVEL" in args else "WARNING") def convert(src, dst, args): logger = log.getLogger("convert()") diff --git a/core/postfix/start.py b/core/postfix/start.py index 3214e077..5a8c2968 100755 --- a/core/postfix/start.py +++ b/core/postfix/start.py @@ -13,7 +13,7 @@ import sys from tenacity import retry from podop import run_server -log.basicConfig(stream=sys.stderr, level=os.environ["LOG_LEVEL"] if "LOG_LEVEL" in os.environ else "WARN") +log.basicConfig(stream=sys.stderr, level=os.environ["LOG_LEVEL"] if "LOG_LEVEL" in os.environ else "WARNING") def start_podop(): os.setuid(100) diff --git a/docs/compose/.env b/docs/compose/.env index 836e9dbf..f65c2f01 100644 --- a/docs/compose/.env +++ b/docs/compose/.env @@ -151,3 +151,6 @@ REAL_IP_FROM= # choose wether mailu bounces (no) or rejects (yes) mail when recipient is unknown (value: yes, no) REJECT_UNLISTED_RECIPIENT= + +# Log level threshold in start.py (value: CRITICAL, ERROR, WARNING, INFO, DEBUG, NOTSET) +LOG_LEVEL=WARNING diff --git a/docs/configuration.rst b/docs/configuration.rst index 2f44b293..ecb42fe5 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -83,6 +83,13 @@ The ``PASSWORD_SCHEME`` is the password encryption scheme. You should use the default value, unless you are importing password from a separate system and want to keep using the old password encryption scheme. +The ``LOG_LEVEL`` setting is used by the python start-up scripts as a logging threshold. +Log messages equal or higher than this priority will be printed. +Can be one of: CRITICAL, ERROR, WARNING, INFO, DEBUG or NOTSET. +See the `python docs`_ for more information. + +.. _`python docs`: https://docs.python.org/3.6/library/logging.html#logging-levels + Infrastructure settings ----------------------- diff --git a/optional/clamav/start.py b/optional/clamav/start.py index 19f91bcf..c08df509 100755 --- a/optional/clamav/start.py +++ b/optional/clamav/start.py @@ -4,7 +4,7 @@ import os import logging as log import sys -log.basicConfig(stream=sys.stderr, level=os.environ["LOG_LEVEL"] if "LOG_LEVEL" in os.environ else "WARN") +log.basicConfig(stream=sys.stderr, level=os.environ["LOG_LEVEL"] if "LOG_LEVEL" in os.environ else "WARNING") logger=log.getLogger(__name__) # Bootstrap the database if clamav is running for the first time diff --git a/services/rspamd/start.py b/services/rspamd/start.py index 8819407f..047bfeba 100755 --- a/services/rspamd/start.py +++ b/services/rspamd/start.py @@ -10,7 +10,7 @@ import sys from tenacity import retry -log.basicConfig(stream=sys.stderr, level=os.environ["LOG_LEVEL"] if "LOG_LEVEL" in os.environ else "WARN") +log.basicConfig(stream=sys.stderr, level=os.environ["LOG_LEVEL"] if "LOG_LEVEL" in os.environ else "WARNING") def convert(src, dst): logger = log.getLogger("convert()") diff --git a/services/unbound/start.py b/services/unbound/start.py index 198934c6..43a52df1 100755 --- a/services/unbound/start.py +++ b/services/unbound/start.py @@ -5,7 +5,7 @@ import os import logging as log import sys -log.basicConfig(stream=sys.stderr, level=os.environ["LOG_LEVEL"] if "LOG_LEVEL" in os.environ else "WARN") +log.basicConfig(stream=sys.stderr, level=os.environ["LOG_LEVEL"] if "LOG_LEVEL" in os.environ else "WARNING") def convert(src, dst): logger = log.getLogger("convert()") diff --git a/setup/flavors/compose/mailu.env b/setup/flavors/compose/mailu.env index 6bdc5e21..2d2b8735 100644 --- a/setup/flavors/compose/mailu.env +++ b/setup/flavors/compose/mailu.env @@ -160,3 +160,6 @@ REAL_IP_FROM={{ real_ip_from }} # choose wether mailu bounces (no) or rejects (yes) mail when recipient is unknown (value: yes, no) REJECT_UNLISTED_RECIPIENT={{ reject_unlisted_recipient }} + +# Log level threshold in start.py (value: CRITICAL, ERROR, WARNING, INFO, DEBUG, NOTSET) +LOG_LEVEL=WARNING diff --git a/webmails/rainloop/start.py b/webmails/rainloop/start.py index 3b4ac3da..defc5be6 100755 --- a/webmails/rainloop/start.py +++ b/webmails/rainloop/start.py @@ -6,7 +6,7 @@ import shutil import logging as log import sys -log.basicConfig(stream=sys.stderr, level=os.environ["LOG_LEVEL"] if "LOG_LEVEL" in os.environ else "WARN") +log.basicConfig(stream=sys.stderr, level=os.environ["LOG_LEVEL"] if "LOG_LEVEL" in os.environ else "WARNING") def convert(src, dst): logger = log.getLogger("convert()") diff --git a/webmails/roundcube/start.py b/webmails/roundcube/start.py index ccb5faf5..8d48d3b6 100755 --- a/webmails/roundcube/start.py +++ b/webmails/roundcube/start.py @@ -5,7 +5,7 @@ import jinja2 import logging as log import sys -log.basicConfig(stream=sys.stderr, level=os.environ["LOG_LEVEL"] if "LOG_LEVEL" in os.environ else "WARN") +log.basicConfig(stream=sys.stderr, level=os.environ["LOG_LEVEL"] if "LOG_LEVEL" in os.environ else "WARNING") def convert(src, dst): logger = log.getLogger("convert()")