Skip to content

MaxListenersExceededWarning when adding loggers dynamically #886

@andymel123

Description

@andymel123

Hi,

I append loggers dynamically with the solution posted here.

The problem with that. With each added logger, file.js adds a 'SIGHUP' listener to process.
process.on('SIGHUP', app.sighupHandler);

Is there a way to tell log4js when I am finished with the specific logger? So that it can remove the listener again? The shutdown function on log4js would shutdown all appenders I guess.

My current workaround (typescript) just removes the listener after it's added. But that's just fighting a symptom of a bigger problem.
process.addListener("newListener", (type, listener) => {...removing that listener again...}

log4js version "^4.3.0"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions