Possible issue preventing altering winston log-level?

  • Plugin & Theme Dev

    Hi guys,
    I'm trying to set the winston.log-level manually on a running NodeBB instance via config.json and it appears the change doesn't take. Is this because the nconf setup should be called at the top of app.js, instead of further down below the winston configuration?

    See winston configuration (first):

    See nconf configuration (second):

    I switched the order of these two sections in my local install and at first glance it appears I'm now able to set the log-level via config.json.

    Should I open a pull request on this?

  • Admin

    Depends... on why you need to change the log level :smile:

    Could be that all you need is to run NodeBB in dev mode?

  • GNU/Linux

    I think the problem is the winston.verbose() already occurring within the loadConfig function.

    I'd move the verbose config-loaded log behind that function call and put the winston configuration in between.
    This way the logging preference may be set via the the config.json and no winston calls would happen before it is loaded.

    It would however prevent proper logging before the config.json file read. In my opinion this is bearable.

  • Plugin & Theme Dev

    Thanks for the feedback. It's not critical and running in dev mode is what I do for most of the cases where I need verbose logging. However, it is good to be able let a server run for a few days to see what happens over a bit of time while users are actually using it (much more rare, but still valid).

  • Admin

    Ah, in that case, might I recommend setting the NODE_ENV environment variable when running NodeBB?

    NODE_ENV=development node app.js

  • Plugin & Theme Dev

    Well that works! Thanks!

Log in to reply

Looks like your connection to NodeBB was lost, please wait while we try to reconnect.