mirror of
https://github.com/NixOS/nix.git
synced 2025-11-19 08:49:35 +01:00
nix daemon: Respect json-log-path and re-open for every connection
We don't want to inherit the parent's JSON logger since then messages from different daemon processes may clobber each other.
This commit is contained in:
parent
bc3a847784
commit
502f027390
3 changed files with 21 additions and 18 deletions
|
|
@ -15,6 +15,7 @@
|
|||
#include "derivations.hh"
|
||||
#include "args.hh"
|
||||
#include "git.hh"
|
||||
#include "logging.hh"
|
||||
|
||||
#ifndef _WIN32 // TODO need graceful async exit support on Windows?
|
||||
# include "monitor-fd.hh"
|
||||
|
|
@ -1044,9 +1045,18 @@ void processConnection(
|
|||
auto tunnelLogger = new TunnelLogger(conn.to, protoVersion);
|
||||
auto prevLogger = nix::logger;
|
||||
// FIXME
|
||||
if (!recursive)
|
||||
if (!recursive) {
|
||||
logger = tunnelLogger;
|
||||
|
||||
if (!loggerSettings.jsonLogPath.get().empty()) {
|
||||
try {
|
||||
logger = makeTeeLogger({logger, makeJSONLogger(std::filesystem::path(loggerSettings.jsonLogPath.get()), false)});
|
||||
} catch (...) {
|
||||
ignoreExceptionExceptInterrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int opCount = 0;
|
||||
|
||||
Finally finally([&]() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue