From d33663f5acaf0b655846b74e91d4a392de5d546b Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 4 Jul 2023 11:54:01 +0100 Subject: [PATCH] Store logs to file --- packages/backend-core/src/logging/pino/logger.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/backend-core/src/logging/pino/logger.ts b/packages/backend-core/src/logging/pino/logger.ts index c96bc83e04..6bcbf481c5 100644 --- a/packages/backend-core/src/logging/pino/logger.ts +++ b/packages/backend-core/src/logging/pino/logger.ts @@ -5,6 +5,9 @@ import * as correlation from "../correlation" import { IdentityType } from "@budibase/types" import { LOG_CONTEXT } from "../index" +import path from "path" +import { budibaseTempDir } from "../../objectStore" + // LOGGER let pinoInstance: pino.Logger | undefined @@ -29,6 +32,13 @@ if (!env.DISABLE_PINO_LOGGER) { singleLine: true, }, } + } else { + pinoOptions.transport = { + target: "pino/file", + options: { + destination: path.join(budibaseTempDir(), "pino.logs"), + }, + } } pinoInstance = pino(pinoOptions)