Set the global level via the configuration object passed to

log4js.configure or target `all` in the `levels` object.
This commit is contained in:
Rolf Koenders 2014-01-21 23:39:54 +01:00
parent 94034e1226
commit 25fa48ee8d

View File

@ -166,6 +166,9 @@ function configureLevels(levels) {
if (levels) {
for (var category in levels) {
if (levels.hasOwnProperty(category)) {
if(category === "all") {
setGlobalLogLevel(levels[category]);
}
getLogger(category).setLevel(levels[category]);
}
}
@ -173,7 +176,9 @@ function configureLevels(levels) {
}
function setGlobalLogLevel(level) {
if(level) {
Logger.prototype.level = levels.toLevel(level, levels.TRACE);
}
}
/**
@ -199,6 +204,7 @@ function configureOnceOff(config, options) {
try {
configureAppenders(config.appenders, options);
configureLevels(config.levels);
setGlobalLogLevel(config.globalLevel);
if (config.replaceConsole) {
replaceConsole();