mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-19 14:13:34 +01:00
log4js: Deprecate the logconfig
setting
This will make it possible to upgrade log4js in a future version.
This commit is contained in:
parent
b3b6c94b76
commit
aec619cc0b
5 changed files with 7 additions and 104 deletions
|
@ -16,6 +16,7 @@
|
|||
|
||||
### Compatibility changes
|
||||
|
||||
* The `logconfig` setting is deprecated.
|
||||
* For plugin authors:
|
||||
* Etherpad now uses [jsdom](https://github.com/jsdom/jsdom) instead of
|
||||
[cheerio](https://cheerio.js.org/) for processing HTML imports. There are
|
||||
|
|
|
@ -586,58 +586,6 @@
|
|||
*/
|
||||
"loglevel": "${LOGLEVEL:INFO}",
|
||||
|
||||
/*
|
||||
* Logging configuration. See log4js documentation for further information:
|
||||
* https://github.com/nomiddlename/log4js-node
|
||||
*
|
||||
* You can add as many appenders as you want here.
|
||||
*/
|
||||
"logconfig" :
|
||||
{ "appenders": [
|
||||
{ "type": "console"
|
||||
//, "category": "access"// only logs pad access
|
||||
}
|
||||
|
||||
/*
|
||||
, { "type": "file"
|
||||
, "filename": "your-log-file-here.log"
|
||||
, "maxLogSize": 1024
|
||||
, "backups": 3 // how many log files there're gonna be at max
|
||||
//, "category": "test" // only log a specific category
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
, { "type": "logLevelFilter"
|
||||
, "level": "warn" // filters out all log messages that have a lower level than "error"
|
||||
, "appender":
|
||||
{ Use whatever appender you want here }
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
, { "type": "logLevelFilter"
|
||||
, "level": "error" // filters out all log messages that have a lower level than "error"
|
||||
, "appender":
|
||||
{ "type": "smtp"
|
||||
, "subject": "An error occurred in your EPL instance!"
|
||||
, "recipients": "bar@blurdybloop.com, baz@blurdybloop.com"
|
||||
, "sendInterval": 300 // 60 * 5 = 5 minutes -- will buffer log messages; set to 0 to send a mail for every message
|
||||
, "transport": "SMTP", "SMTP": { // see https://github.com/andris9/Nodemailer#possible-transport-methods
|
||||
"host": "smtp.example.com", "port": 465,
|
||||
"secureConnection": true,
|
||||
"auth": {
|
||||
"user": "foo@example.com",
|
||||
"pass": "bar_foo"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
]
|
||||
}, // logconfig
|
||||
|
||||
/* Override any strings found in locale directories */
|
||||
"customLocaleStrings": {}
|
||||
}
|
||||
|
|
|
@ -590,58 +590,6 @@
|
|||
*/
|
||||
"loglevel": "INFO",
|
||||
|
||||
/*
|
||||
* Logging configuration. See log4js documentation for further information:
|
||||
* https://github.com/nomiddlename/log4js-node
|
||||
*
|
||||
* You can add as many appenders as you want here.
|
||||
*/
|
||||
"logconfig" :
|
||||
{ "appenders": [
|
||||
{ "type": "console"
|
||||
//, "category": "access"// only logs pad access
|
||||
}
|
||||
|
||||
/*
|
||||
, { "type": "file"
|
||||
, "filename": "your-log-file-here.log"
|
||||
, "maxLogSize": 1024
|
||||
, "backups": 3 // how many log files there're gonna be at max
|
||||
//, "category": "test" // only log a specific category
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
, { "type": "logLevelFilter"
|
||||
, "level": "warn" // filters out all log messages that have a lower level than "error"
|
||||
, "appender":
|
||||
{ Use whatever appender you want here }
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
, { "type": "logLevelFilter"
|
||||
, "level": "error" // filters out all log messages that have a lower level than "error"
|
||||
, "appender":
|
||||
{ "type": "smtp"
|
||||
, "subject": "An error occurred in your EPL instance!"
|
||||
, "recipients": "bar@blurdybloop.com, baz@blurdybloop.com"
|
||||
, "sendInterval": 300 // 60 * 5 = 5 minutes -- will buffer log messages; set to 0 to send a mail for every message
|
||||
, "transport": "SMTP", "SMTP": { // see https://github.com/andris9/Nodemailer#possible-transport-methods
|
||||
"host": "smtp.example.com", "port": 465,
|
||||
"secureConnection": true,
|
||||
"auth": {
|
||||
"user": "foo@example.com",
|
||||
"pass": "bar_foo"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
]
|
||||
}, // logconfig
|
||||
|
||||
/* Override any strings found in locale directories */
|
||||
"customLocaleStrings": {},
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
*/
|
||||
|
||||
const absolutePaths = require('./AbsolutePaths');
|
||||
const deepEqual = require('fast-deep-equal/es6');
|
||||
const fs = require('fs');
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
|
@ -47,9 +48,13 @@ const defaultLogConfig = () => ({appenders: [{type: 'console'}]});
|
|||
const defaultLogLevel = 'INFO';
|
||||
|
||||
const initLogging = (logLevel, config) => {
|
||||
// log4js.configure() modifies exports.logconfig so check for equality first.
|
||||
const logConfigIsDefault = deepEqual(config, defaultLogConfig());
|
||||
log4js.configure(config);
|
||||
log4js.setGlobalLogLevel(logLevel);
|
||||
log4js.replaceConsole();
|
||||
// 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
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
"express": "4.17.1",
|
||||
"express-rate-limit": "5.3.0",
|
||||
"express-session": "1.17.2",
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"find-root": "1.1.0",
|
||||
"formidable": "1.2.2",
|
||||
"http-errors": "1.8.0",
|
||||
|
|
Loading…
Reference in a new issue