Set the global level via the configuration object passed to
log4js.configure or target `all` in the `levels` object.
This commit is contained in:
parent
94034e1226
commit
25fa48ee8d
@ -166,6 +166,9 @@ function configureLevels(levels) {
|
|||||||
if (levels) {
|
if (levels) {
|
||||||
for (var category in levels) {
|
for (var category in levels) {
|
||||||
if (levels.hasOwnProperty(category)) {
|
if (levels.hasOwnProperty(category)) {
|
||||||
|
if(category === "all") {
|
||||||
|
setGlobalLogLevel(levels[category]);
|
||||||
|
}
|
||||||
getLogger(category).setLevel(levels[category]);
|
getLogger(category).setLevel(levels[category]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -173,7 +176,9 @@ function configureLevels(levels) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setGlobalLogLevel(level) {
|
function setGlobalLogLevel(level) {
|
||||||
Logger.prototype.level = levels.toLevel(level, levels.TRACE);
|
if(level) {
|
||||||
|
Logger.prototype.level = levels.toLevel(level, levels.TRACE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -199,6 +204,7 @@ function configureOnceOff(config, options) {
|
|||||||
try {
|
try {
|
||||||
configureAppenders(config.appenders, options);
|
configureAppenders(config.appenders, options);
|
||||||
configureLevels(config.levels);
|
configureLevels(config.levels);
|
||||||
|
setGlobalLogLevel(config.globalLevel);
|
||||||
|
|
||||||
if (config.replaceConsole) {
|
if (config.replaceConsole) {
|
||||||
replaceConsole();
|
replaceConsole();
|
||||||
|
Loading…
Reference in New Issue
Block a user