mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 07:56:16 -04:00
fix: The log level is now respected again. (#6076)
This commit is contained in:
parent
d12119d3be
commit
51def0eba6
1 changed files with 21 additions and 22 deletions
|
@ -50,15 +50,14 @@ const nonSettings = [
|
||||||
|
|
||||||
// This is a function to make it easy to create a new instance. It is important to not reuse a
|
// This is a function to make it easy to create a new instance. It is important to not reuse a
|
||||||
// config object after passing it to log4js.configure() because that method mutates the object. :(
|
// config object after passing it to log4js.configure() because that method mutates the object. :(
|
||||||
const defaultLogConfig = () => ({appenders: {console: {type: 'console'}},
|
const defaultLogConfig = (level) => ({appenders: {console: {type: 'console'}},
|
||||||
categories: {
|
categories: {
|
||||||
default: {appenders: ['console'], level: 'info'},
|
default: {appenders: ['console'], level},
|
||||||
}});
|
}});
|
||||||
const defaultLogLevel = 'INFO';
|
const defaultLogLevel = 'INFO';
|
||||||
|
|
||||||
const initLogging = (logLevel, config) => {
|
const initLogging = (logLevel, config) => {
|
||||||
// log4js.configure() modifies exports.logconfig so check for equality first.
|
// log4js.configure() modifies exports.logconfig so check for equality first.
|
||||||
const logConfigIsDefault = deepEqual(config, defaultLogConfig());
|
|
||||||
log4js.configure(config);
|
log4js.configure(config);
|
||||||
log4js.getLogger('console');
|
log4js.getLogger('console');
|
||||||
|
|
||||||
|
@ -67,14 +66,11 @@ const initLogging = (logLevel, config) => {
|
||||||
console.log = logger.info.bind(logger);
|
console.log = logger.info.bind(logger);
|
||||||
console.warn = logger.warn.bind(logger);
|
console.warn = logger.warn.bind(logger);
|
||||||
console.error = logger.error.bind(logger);
|
console.error = logger.error.bind(logger);
|
||||||
|
|
||||||
// Log the warning after configuring log4js to increase the chances the user will see it.
|
|
||||||
if (!logConfigIsDefault) logger.warn('The logconfig setting is deprecated.');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Initialize logging as early as possible with reasonable defaults. Logging will be re-initialized
|
// Initialize logging as early as possible with reasonable defaults. Logging will be re-initialized
|
||||||
// with the user's chosen log level and logger config after the settings have been loaded.
|
// with the user's chosen log level and logger config after the settings have been loaded.
|
||||||
initLogging(defaultLogLevel, defaultLogConfig());
|
initLogging(defaultLogLevel, defaultLogConfig(defaultLogLevel));
|
||||||
|
|
||||||
/* Root path of the installation */
|
/* Root path of the installation */
|
||||||
exports.root = absolutePaths.findEtherpadRoot();
|
exports.root = absolutePaths.findEtherpadRoot();
|
||||||
|
@ -298,7 +294,7 @@ exports.indentationOnNewLine = true;
|
||||||
/*
|
/*
|
||||||
* log4js appender configuration
|
* log4js appender configuration
|
||||||
*/
|
*/
|
||||||
exports.logconfig = defaultLogConfig();
|
exports.logconfig = null;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Deprecated cookie signing key.
|
* Deprecated cookie signing key.
|
||||||
|
@ -738,6 +734,8 @@ exports.reloadSettings = () => {
|
||||||
storeSettings(settings);
|
storeSettings(settings);
|
||||||
storeSettings(credentials);
|
storeSettings(credentials);
|
||||||
|
|
||||||
|
// Init logging config
|
||||||
|
exports.logconfig = defaultLogConfig(exports.loglevel ? exports.loglevel : defaultLogLevel);
|
||||||
initLogging(exports.loglevel, exports.logconfig);
|
initLogging(exports.loglevel, exports.logconfig);
|
||||||
|
|
||||||
if (!exports.skinName) {
|
if (!exports.skinName) {
|
||||||
|
@ -871,3 +869,4 @@ exports.exportedForTestingOnly = {
|
||||||
|
|
||||||
// initially load settings
|
// initially load settings
|
||||||
exports.reloadSettings();
|
exports.reloadSettings();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue