Skip to content

Commit

Permalink
mailman: log to journal
Browse files Browse the repository at this point in the history
  • Loading branch information
lheckemann committed Jun 18, 2020
1 parent 3dbbc78 commit 176bc68
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
6 changes: 5 additions & 1 deletion nixos/modules/services/mail/mailman.nix
Expand Up @@ -185,7 +185,11 @@ in {
enable = "yes";
configuration = "/var/lib/mailman/mailman-hyperkitty.cfg";
};
};
} // (let
loggerNames = ["root" "archiver" "bounce" "config" "database" "debug" "error" "fromusenet" "http" "locks" "mischief" "plugins" "runner" "smtp"];
loggerSectionNames = map (n: "logging.${n}") loggerNames;
in lib.genAttrs loggerSectionNames(name: { handler = "stderr"; })
);

assertions = let
inherit (config.services) postfix;
Expand Down
16 changes: 14 additions & 2 deletions pkgs/servers/mail/mailman/default.nix
@@ -1,4 +1,4 @@
{ stdenv, buildPythonPackage, fetchPypi, isPy3k, alembic, aiosmtpd, dnspython
{ stdenv, buildPythonPackage, fetchPypi, fetchpatch, isPy3k, alembic, aiosmtpd, dnspython
, flufl_bounce, flufl_i18n, flufl_lock, lazr_config, lazr_delegates, passlib
, requests, zope_configuration, click, falcon, importlib-resources
, zope_component, lynx, postfix, authheaders, gunicorn
Expand All @@ -20,7 +20,19 @@ buildPythonPackage rec {
zope_component authheaders gunicorn
];

patchPhase = ''
patches = [
(fetchpatch {
url = https://gitlab.com/mailman/mailman/-/commit/4b206e2a5267a0e17f345fd7b2d957122ba57566.patch;
sha256 = "06axmrn74p81wvcki36c7gfj5fp5q15zxz2yl3lrvijic7hbs4n2";
})
(fetchpatch {
url = https://gitlab.com/mailman/mailman/-/commit/9613154f3c04fa2383fbf017031ef263c291418d.patch;
sha256 = "0vyw87s857vfxbf7kihwb6w094xyxmxbi1bpdqi3ybjamjycp55r";
})
./log-stderr.patch
];

postPatch = ''
substituteInPlace src/mailman/config/postfix.cfg \
--replace /usr/sbin/postmap ${postfix}/bin/postmap
substituteInPlace src/mailman/config/schema.cfg \
Expand Down
13 changes: 13 additions & 0 deletions pkgs/servers/mail/mailman/log-stderr.patch
@@ -0,0 +1,13 @@
diff --git a/src/mailman/core/logging.py b/src/mailman/core/logging.py
index f8f87279f..7ff13b003 100644
--- a/src/mailman/core/logging.py
+++ b/src/mailman/core/logging.py
@@ -142,6 +142,8 @@ def _init_logger(propagate, sub_name, log, logger_config):
address, facility = _get_syslog_params(logger_config)
handler = logging.handlers.SysLogHandler(
address=address, facility=facility)
+ elif logger_config.handler == 'stderr':
+ handler = logging.StreamHandler(sys.stderr)
else:
path_str = logger_config.path
path_abs = os.path.normpath(os.path.join(config.LOG_DIR, path_str))

0 comments on commit 176bc68

Please sign in to comment.