Skip to content

Commit

Permalink
Only json logs when activated (#6974)
Browse files Browse the repository at this point in the history
* Only JSON_LOGS when active

when JSON_LOGS env var is active deactivate graylog and file
transports

* bump version
  • Loading branch information
daneryl committed Jul 5, 2024
1 parent 646348b commit 9e7d28f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions app/api/log/errorLog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ const createErrorLog = () => {
DATABASE_NAME = process.env.DATABASE_NAME ? process.env.DATABASE_NAME : 'localhost';
LOGS_DIR = process.env.LOGS_DIR ? process.env.LOGS_DIR : './log';

const transports = [createFileTransport(), createConsoleTransport()];
let transports = [createFileTransport(), createConsoleTransport()];
if (config.JSON_LOGS) {
transports.push(createJSONConsoleTransport());
transports = [createJSONConsoleTransport()];
}

const logger: ExtendedLogger = winston.createLogger({
Expand All @@ -49,7 +49,7 @@ const createErrorLog = () => {
cb();
};

if (process.env.USE_GRAYLOG) {
if (process.env.USE_GRAYLOG && !config.JSON_LOGS) {
const graylogTransport = new GrayLogTransport({
format: formatter(DATABASE_NAME),
instance_name: DATABASE_NAME,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "uwazi",
"version": "1.174.0-rc4",
"version": "1.174.0-rc5",
"description": "Uwazi is a free, open-source solution for organising, analysing and publishing your documents.",
"keywords": [
"react"
Expand Down

0 comments on commit 9e7d28f

Please sign in to comment.