Closed artiely closed 2 years ago
While your project is in ESM, log4js
is in CJS.
Thus, when log4js
(CJS) attempts to require your custom appender log.js
(ESM), it will not work.
There are two ways:
Your log.js
custom appender can be explicitly declared as a CJS.
With PR #1280, rename log.js
to log.cjs
. That should work.
Alternatively, you can also take a look at
https://github.com/log4js-node/log4js-node/issues/1122#issuecomment-1155285459 by importing the appender yourself and then passing it to log4js.configure()
.
@artiely Did you managed to get this resolved?
package.json
node v16.15.0 log4js ^6.4.5
log.js