When starting npm I am facing an error. The error states that "Error: log4js configuration problem for { type: 'log4js-syslog-appender'," Essentially seems like the format for the log4js config might be wrong. I am a complete newbie to node and would appreciate any pointers on what may be a good next step here.
I have inherited a bunch of code that was written with Node 4.2 and npm 3.x I have had to compile openssl fips binaries and then recompile and reinstall node (6.11.1) and npm with it (3.10.10). I am now simply trying to do npm start and running into an error.
Config.js looks like this for the log4js part:
/*
|--------------------------------------------------
| Logging
|--------------------------------------------------
*/
var log4js = require('log4js');
var use_syslog = process.env.LOG_SYSLOG == "true";
var appenders = [ { type: 'console' } ];
if (use_syslog) {
appenders.push({ type: 'log4js-syslog-appender',
tag: 'API',
facility: 'local0',
path: '/dev/log',
transport: 'socket' });
}
log4js.configure({
appenders: appenders
});
config.logger = use_syslog ? log4js.getLogger('syslog') : log4js.getLogger('console') ;
config.logger.setLevel(process.env.DEBUG_LEVEL);
I would like to find a way to solve this error but cannot figure out what exact change I need to make in the config.js file. If any direction can be provided it'll be great.
The exact error is as below:
==========================================================================
oi@oi01:~/api$ npm start
> oi-api@2.0.0 start /home/oi/api
> babel-node server.js --presets es2015
/home/oi/api/node_modules/log4js/lib/log4js.js:316
throw new Error(
^
Error: Problem reading log4js config { appenders:
[ { type: 'console', makers: [Object] },
{ type: 'log4js-syslog-appender',
tag: 'API',
facility: 'local0',
path: '/dev/log',
transport: 'socket',
makers: [Object] } ] }. Error was "log4js configuration problem for { type: 'log4js-syslog-appender',
tag: 'API',
facility: 'local0',
path: '/dev/log',
transport: 'socket',
makers:
{ console: [Function: bound configure],
'log4js-syslog-appender': [Function: bound configure] } }" (Error: log4js configuration problem for { type: 'log4js-syslog-appender',
tag: 'API',
facility: 'local0',
path: '/dev/log',
transport: 'socket',
makers:
{ console: [Function: bound configure],
'log4js-syslog-appender': [Function: bound configure] } }
at /home/oi/api/node_modules/log4js/lib/log4js.js:256:15
at Array.forEach (native)
at configureAppenders (/home/oi/api/node_modules/log4js/lib/log4js.js:248:18)
at configureOnceOff (/home/oi/api/node_modules/log4js/lib/log4js.js:308:7)
at Object.configure (/home/oi/api/node_modules/log4js/lib/log4js.js:371:3)
at Object.<anonymous> (/home/oi/api/config/config.js:92:8)
at Module._compile (module.js:570:32)
at loader (/home/oi/api/node_modules/babel-register/lib/node.js:144:5)
at Object.require.extensions.(anonymous function) [as .js] (/home/oi/api/node_modules/babel-register/lib/node.js:154:7)
at Module.load (module.js:487:32))
at configureOnceOff (/home/oi/api/node_modules/log4js/lib/log4js.js:316:13)
at Object.configure (/home/oi/api/node_modules/log4js/lib/log4js.js:371:3)
at Object.<anonymous> (/home/oi/api/config/config.js:92:8)
at Module._compile (module.js:570:32)
at loader (/home/oi/api/node_modules/babel-register/lib/node.js:144:5)
at Object.require.extensions.(anonymous function) [as .js] (/home/oi/api/node_modules/babel-register/lib/node.js:154:7)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
npm ERR! Linux 4.4.0-1002-fips
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v6.11.1
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! oi-api@2.0.0 start: `babel-node server.js --presets es2015`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the oi-api@2.0.0 start script 'babel-node server.js --presets es2015'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the oi-api package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! babel-node server.js --presets es2015
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs oi-api
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls oi-api
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/oi/api/npm-debug.log
===============================================================