Parse-server: cannot disable cloud code logs

Created on 11 Oct 2016  路  9Comments  路  Source: parse-community/parse-server

Env

Parse Server 2.2.22

Problem

I want to disable these logs

info: afterSave triggered for .... 

I try this

loggerAdapter: {
        module: "parse-server/lib/Adapters/Logger/WinstonLoggerAdapter",
        options: {
            level: config.DEBUG ? "info" : "error"
        }
    },

and try also this

console.info = function(){}

but these logs still appear in the console pm2 logs

Most helpful comment

@benishak if you use

loggerAdapter: {
        module: "parse-server/lib/Adapters/Logger/WinstonLoggerAdapter",
        options: {
            logLevel: config.DEBUG ? "info" : "error"
        }
    },

note that it is logLevel not level

Also if you replace your whole loggerAdapter: { },... with just logLevel: "error",

it should also work. I have tested both.

My response to you yesterday was incorrect in that i told you that the top level key was level not logLevel sorry for sending you down the wrong path.

All 9 comments

hi @benishak

The key is logLevel not level

I'll look at where to add this in the documentation. I'm going to close this, but re-open if it doesn't solve for you.

and now that I've looked into it a little more, here's a better answer:

Winston is expecting logLevel, but parse-server uses just level. Confusing :(.

So if you want to use the default logger, which you are, and you just want to adjust the log level, you can do it by simply setting the level key in your config and not even bothering with the loggerAdapter key.

this doesn't work I tried

level :

and

loggerAdapter: {
        options: {
            level: config.DEBUG ? "info" : "error"
        }
    },

actually I got an error when not defining the module

@benishak if you use

loggerAdapter: {
        module: "parse-server/lib/Adapters/Logger/WinstonLoggerAdapter",
        options: {
            logLevel: config.DEBUG ? "info" : "error"
        }
    },

note that it is logLevel not level

Also if you replace your whole loggerAdapter: { },... with just logLevel: "error",

it should also work. I have tested both.

My response to you yesterday was incorrect in that i told you that the top level key was level not logLevel sorry for sending you down the wrong path.

Thanks for this.. it was driving me mad seeing the data for each cloud function when I wanted to see it for one particular function.

@acinader this is a pretty old issue but the logLevel at the top level of the config is good and important enough information to put on the front page

I meant putting it on the README. Sorry for the ambiguity.

There's nothing that prevents you from doing it

Was this page helpful?
0 / 5 - 0 ratings