log4js-node / log4js-node

A port of log4js to node.js
https://log4js-node.github.io/log4js-node/
Other
5.79k stars 774 forks source link

The "path" argument must be of type string #1086

Closed hxkuc closed 2 years ago

hxkuc commented 3 years ago

internal/validators.js:112 throw new ERR_INVALID_ARG_TYPE(name, 'string', value); ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined at validateString (internal/validators.js:112:11) at Object.dirname (path.js:583:5) at loadAppenderModule (webpack://zmlearn/./dist/dev/node_modules/log4js/lib/appenders/index.js?:41:81) at createAppender (webpack://zmlearn/./dist/dev/node_modules/log4js/lib/appenders/index.js?:63:29) at getAppender (webpack://zmlearn/./dist/dev/node_modules/log4js/lib/appenders/index.js?:54:20) at eval (webpack://zmlearn/./dist/dev/node_modules/log4js/lib/appenders/index.js?:100:7) at Array.forEach () at setup (webpack://zmlearn/./dist/dev/node_modules/log4js/lib/appenders/index.js?:96:33) at eval (webpack://zmlearn/./dist/dev/node_modules/log4js/lib/configuration.js?:46:33) at Array.forEach ()

hxkuc commented 3 years ago

log4js/lib/appenders/index.js?:41 (require.main && tryLoading(path.join(path.dirname(require.main.filename), type), config)

change? (require.main && require.main.filename && tryLoading(path.join(path.dirname(require.main.filename), type), config)

hxkuc commented 3 years ago

https://github.com/DataDog/dd-trace-js/pull/973/files

hxkuc commented 3 years ago

6.3.0

lamweili commented 2 years ago

log4js/lib/appenders/index.js?:41 (require.main && tryLoading(path.join(path.dirname(require.main.filename), type), config)

change? (require.main && require.main.filename && tryLoading(path.join(path.dirname(require.main.filename), type), config)

https://github.com/DataDog/dd-trace-js/pull/973/files

Good change for defensive coding, which is similar to https://github.com/DataDog/dd-trace-js/pull/973/files.