diff --git a/backend/src/config/index.ts b/backend/src/config/index.ts index 4269802aa..93b712fa1 100644 --- a/backend/src/config/index.ts +++ b/backend/src/config/index.ts @@ -18,6 +18,7 @@ const database = { DB_USER: process.env.DB_USER || 'root', DB_PASSWORD: process.env.DB_PASSWORD || '', DB_DATABASE: process.env.DB_DATABASE || 'gradido_community', + TYPEORM_LOGGING_RELATIVE_PATH: process.env.TYPEORM_LOGGING_RELATIVE_PATH || '../deployment/bare_metal/log/typeorm.backend.log' } const klicktipp = { diff --git a/backend/src/typeorm/connection.ts b/backend/src/typeorm/connection.ts index 5709c29b6..9ffebf9b2 100644 --- a/backend/src/typeorm/connection.ts +++ b/backend/src/typeorm/connection.ts @@ -1,4 +1,4 @@ -import { createConnection, Connection } from 'typeorm' +import { createConnection, Connection, FileLogger } from 'typeorm' import CONFIG from '../config' import { entities } from '@entity/index' @@ -15,6 +15,10 @@ const connection = async (): Promise => { database: CONFIG.DB_DATABASE, entities, synchronize: false, + logging: true, + logger: new FileLogger("all", { + logPath: CONFIG.TYPEORM_LOGGING_RELATIVE_PATH + }), }) } catch (error) { // eslint-disable-next-line no-console