@@ -50,15 +50,14 @@ const nonSettings = [
5050
5151// This is a function to make it easy to create a new instance. It is important to not reuse a
5252// config object after passing it to log4js.configure() because that method mutates the object. :(
53- const defaultLogConfig = ( ) => ( { appenders : { console : { type : 'console' } } ,
53+ const defaultLogConfig = ( level ) => ( { appenders : { console : { type : 'console' } } ,
5454 categories : {
55- default : { appenders : [ 'console' ] , level : 'info' } ,
55+ default : { appenders : [ 'console' ] , level} ,
5656 } } ) ;
5757const defaultLogLevel = 'INFO' ;
5858
5959const initLogging = ( logLevel , config ) => {
6060 // log4js.configure() modifies exports.logconfig so check for equality first.
61- const logConfigIsDefault = deepEqual ( config , defaultLogConfig ( ) ) ;
6261 log4js . configure ( config ) ;
6362 log4js . getLogger ( 'console' ) ;
6463
@@ -67,19 +66,16 @@ const initLogging = (logLevel, config) => {
6766 console . log = logger . info . bind ( logger ) ;
6867 console . warn = logger . warn . bind ( logger ) ;
6968 console . error = logger . error . bind ( logger ) ;
70-
71- // Log the warning after configuring log4js to increase the chances the user will see it.
72- if ( ! logConfigIsDefault ) logger . warn ( 'The logconfig setting is deprecated.' ) ;
7369} ;
7470
7571// Initialize logging as early as possible with reasonable defaults. Logging will be re-initialized
7672// with the user's chosen log level and logger config after the settings have been loaded.
77- initLogging ( defaultLogLevel , defaultLogConfig ( ) ) ;
73+ initLogging ( defaultLogLevel , defaultLogConfig ( defaultLogLevel ) ) ;
7874
7975/* Root path of the installation */
8076exports . root = absolutePaths . findEtherpadRoot ( ) ;
8177logger . info ( 'All relative paths will be interpreted relative to the identified ' +
82- `Etherpad base dir: ${ exports . root } ` ) ;
78+ `Etherpad base dir: ${ exports . root } ` ) ;
8379exports . settingsFilename = absolutePaths . makeAbsolute ( argv . settings || 'settings.json' ) ;
8480exports . credentialsFilename = absolutePaths . makeAbsolute ( argv . credentials || 'credentials.json' ) ;
8581
@@ -160,7 +156,7 @@ exports.defaultPadText = [
160156 'Welcome to Etherpad!' ,
161157 '' ,
162158 'This pad text is synchronized as you type, so that everyone viewing this page sees the same ' +
163- 'text. This allows you to collaborate seamlessly on documents!' ,
159+ 'text. This allows you to collaborate seamlessly on documents!' ,
164160 '' ,
165161 'Etherpad on Github: https://github.com/ether/etherpad-lite' ,
166162] . join ( '\n' ) ;
@@ -298,7 +294,7 @@ exports.indentationOnNewLine = true;
298294/*
299295 * log4js appender configuration
300296 */
301- exports . logconfig = defaultLogConfig ( ) ;
297+ exports . logconfig = null ;
302298
303299/*
304300 * Deprecated cookie signing key.
@@ -646,9 +642,9 @@ const lookupEnvironmentVariables = (obj) => {
646642
647643 if ( ( envVarValue === undefined ) && ( defaultValue === undefined ) ) {
648644 logger . warn ( `Environment variable "${ envVarName } " does not contain any value for ` +
649- `configuration key "${ key } ", and no default was given. Using null. ` +
650- 'THIS BEHAVIOR MAY CHANGE IN A FUTURE VERSION OF ETHERPAD; you should ' +
651- 'explicitly use "null" as the default if you want to continue to use null.' ) ;
645+ `configuration key "${ key } ", and no default was given. Using null. ` +
646+ 'THIS BEHAVIOR MAY CHANGE IN A FUTURE VERSION OF ETHERPAD; you should ' +
647+ 'explicitly use "null" as the default if you want to continue to use null.' ) ;
652648
653649 /*
654650 * We have to return null, because if we just returned undefined, the
@@ -659,7 +655,7 @@ const lookupEnvironmentVariables = (obj) => {
659655
660656 if ( ( envVarValue === undefined ) && ( defaultValue !== undefined ) ) {
661657 logger . debug ( `Environment variable "${ envVarName } " not found for ` +
662- `configuration key "${ key } ". Falling back to default value.` ) ;
658+ `configuration key "${ key } ". Falling back to default value.` ) ;
663659
664660 return coerceValue ( defaultValue ) ;
665661 }
@@ -726,7 +722,7 @@ const parseSettings = (settingsFilename, isSettings) => {
726722 return replacedSettings ;
727723 } catch ( e ) {
728724 logger . error ( `There was an error processing your ${ settingsType } ` +
729- `file from ${ settingsFilename } : ${ e . message } ` ) ;
725+ `file from ${ settingsFilename } : ${ e . message } ` ) ;
730726
731727 process . exit ( 1 ) ;
732728 }
@@ -738,11 +734,13 @@ exports.reloadSettings = () => {
738734 storeSettings ( settings ) ;
739735 storeSettings ( credentials ) ;
740736
737+ // Init logging config
738+ exports . logconfig = defaultLogConfig ( exports . loglevel ? exports . loglevel : defaultLogLevel ) ;
741739 initLogging ( exports . loglevel , exports . logconfig ) ;
742740
743741 if ( ! exports . skinName ) {
744742 logger . warn ( 'No "skinName" parameter found. Please check out settings.json.template and ' +
745- 'update your settings.json. Falling back to the default "colibris".' ) ;
743+ 'update your settings.json. Falling back to the default "colibris".' ) ;
746744 exports . skinName = 'colibris' ;
747745 }
748746
@@ -753,7 +751,7 @@ exports.reloadSettings = () => {
753751
754752 if ( countPieces !== 1 ) {
755753 logger . error ( `skinName must be the name of a directory under "${ skinBasePath } ". This is ` +
756- `not valid: "${ exports . skinName } ". Falling back to the default "colibris".` ) ;
754+ `not valid: "${ exports . skinName } ". Falling back to the default "colibris".` ) ;
757755
758756 exports . skinName = 'colibris' ;
759757 }
@@ -764,7 +762,7 @@ exports.reloadSettings = () => {
764762 // what if someone sets skinName == ".." or "."? We catch him!
765763 if ( absolutePaths . isSubdir ( skinBasePath , skinPath ) === false ) {
766764 logger . error ( `Skin path ${ skinPath } must be a subdirectory of ${ skinBasePath } . ` +
767- 'Falling back to the default "colibris".' ) ;
765+ 'Falling back to the default "colibris".' ) ;
768766
769767 exports . skinName = 'colibris' ;
770768 skinPath = path . join ( skinBasePath , exports . skinName ) ;
@@ -825,9 +823,9 @@ exports.reloadSettings = () => {
825823 }
826824 } else {
827825 logger . warn ( 'Declaring the sessionKey in the settings.json is deprecated. ' +
828- 'This value is auto-generated now. Please remove the setting from the file. -- ' +
829- 'If you are seeing this error after restarting using the Admin User ' +
830- 'Interface then you can ignore this message.' ) ;
826+ 'This value is auto-generated now. Please remove the setting from the file. -- ' +
827+ 'If you are seeing this error after restarting using the Admin User ' +
828+ 'Interface then you can ignore this message.' ) ;
831829 }
832830 if ( exports . sessionKey ) {
833831 logger . warn ( `The sessionKey setting and ${ sessionkeyFilename } file are deprecated; ` +
@@ -847,7 +845,7 @@ exports.reloadSettings = () => {
847845 if ( exports . ip === '' ) {
848846 // using Unix socket for connectivity
849847 logger . warn ( 'The settings file contains an empty string ("") for the "ip" parameter. The ' +
850- '"port" parameter will be interpreted as the path to a Unix socket to bind at.' ) ;
848+ '"port" parameter will be interpreted as the path to a Unix socket to bind at.' ) ;
851849 }
852850
853851 /*
@@ -871,3 +869,4 @@ exports.exportedForTestingOnly = {
871869
872870// initially load settings
873871exports . reloadSettings ( ) ;
872+
0 commit comments