diff --git a/ts/logging/main_process_logging.ts b/ts/logging/main_process_logging.ts index 84c6d10e8e20..4614a2c2d0d4 100644 --- a/ts/logging/main_process_logging.ts +++ b/ts/logging/main_process_logging.ts @@ -69,6 +69,14 @@ export async function initialize(): Promise { rotate: 3, }); + stream.on('close', () => { + globalLogger = undefined; + }); + + stream.on('error', () => { + globalLogger = undefined; + }); + const streams: pinoms.Streams = []; streams.push({ stream }); diff --git a/ts/logging/set_up_renderer_logging.ts b/ts/logging/set_up_renderer_logging.ts index c4d83508bca1..4a69ecd5afa2 100644 --- a/ts/logging/set_up_renderer_logging.ts +++ b/ts/logging/set_up_renderer_logging.ts @@ -112,6 +112,14 @@ export function initialize(): void { rotate: 3, }); + stream.on('close', () => { + globalLogger = undefined; + }); + + stream.on('error', () => { + globalLogger = undefined; + }); + globalLogger = pino( { timestamp: pino.stdTimeFunctions.isoTime,