Set global level in log4js.configure? #87

Closed
Sefarth opened this Issue Aug 3, 2012 · 15 comments

Comments

Projects
None yet
9 participants

Sefarth commented Aug 3, 2012

Is there a way to set the global level using the configuration json?

Right now I'm using log4js.setGlobalLogLevel to programmatically set it, but i think it would be nice if I could set it in my configuration file:

log4js.configure({
    appenders : [
        {type: 'console'}
    ],
    levels : {
        'log2' : "warn"
    },
    globalLogLevel : "error"
});

I also need this.
I tried to set the default and all categories, but to no avail

levels: {
  "[all]": "WARN,
  "[default]": "WARN
}

jobe451 commented Apr 2, 2013

This would also make very much sense for me. Especially in relation with the config file auto reload feature this seems to be usefull to set the application globally to debug.

blalor commented Jul 28, 2013

+1

Contributor

RolfKoenders commented Jan 21, 2014

Which option would you guys prefer?
An globalLevel option in the configure object?

{
   globalLevel: 'ERROR'
}

Or go for the 'all' category in 'levels'

levels: {
   'all': 'ERROR'
}

Both are in the merge request.

I'd prefer the 'all' in 'levels'. It seems more natural to me, to have all levels at the same place called 'levels' =)

Contributor

RolfKoenders commented Jan 22, 2014

Exactly ;)

+1

Philippe Paravicini
(707) 364-1550
skype: pparavicini

---------- Original Message ----------

Subject: Re: [log4js-node] Set global level in log4js.configure? (#87)
Date: Wednesday, January 22, 2014, 00:35:17
From: Mladen Markov notifications@github.com
To: nomiddlename/log4js-node log4js-node@noreply.github.com
CC: Philippe Paravicini pparavicini@januxmedia.com

I'd prefer the 'all' in 'levels'. It seems more natural to me, to have all
levels at the same place called 'levels' =)


Reply to this email directly or view it on GitHub:

nomiddlename#87 (comment)

Contributor

RolfKoenders commented Jan 22, 2014

I will remove the 'globalLevel' option from my merge request. Than it only contains the 'levels' option ;)

RolfKoenders pushed a commit to RolfKoenders/log4js-node that referenced this issue Jan 22, 2014

Contributor

RolfKoenders commented May 1, 2014

Is this going to be in? What shall i change?

Collaborator

nomiddlename commented May 1, 2014

Hi Rolf - sorry for not getting back to you sooner. Would you be able to add a test, please? Once I've got a test covering it, I'll be happy to merge it in.

Contributor

RolfKoenders commented May 4, 2014

Added test case in 'test/global-log-level-test.js'

+1 - any news yet?

Collaborator

nomiddlename commented Jul 18, 2014

Released to npm in version 0.6.16

Looks like the correct way to do this is

levels: {
'[all]': 'ERROR'
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment