log4js-node icon indicating copy to clipboard operation
log4js-node copied to clipboard

"TypeError: Cannot convert object to primitive value" in cluster mode

Open Druson opened this issue 2 years ago • 0 comments

When I try to print the axios error in cluster mode, it failed with error TypeError: Cannot convert object to primitive value in the worker process.

code to reproduce this issue:

var axios = require('axios')
var cluster = require('node:cluster');
var log4js = require('log4js')
var logger = log4js.getLogger();
logger.level = "debug";
if (cluster.isPrimary) {
    cluster.fork();
} else {
    axios.get('http://local01host')
        .catch(err => {
            logger.error(err);
        });
}

nodejs version: v21.5.0, axios and log4js are the latest version.

Druson avatar Feb 10 '24 08:02 Druson