log4js-node / log4js-node/log4js-node

Problem of Dispatching log to different PM2 cluster master

Open
#723 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
5.8k
Forks
752
PR merge metrics
No merged PRs in 30d

Description

I run multiple PM2 cluster services in one PM2 instance and every service has a different pm2 'instance_var' name config. And every log4js config in the pm2 service has a correspond 'pm2InstanceVar' name config.

When the services run, the logs just merge together.

I think log4js can find the master process of each cluster service, but every master process prints all cluster services's logs.

How about make a cluster worker send log message with the instance_var in the message. Then the master process will know which log should be ignored.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the setup with multiple PM2 cluster services in one instance, using distinct instance_var and pm2InstanceVar values. Trace how worker log messages reach the cluster masters and determine whether the instance identifier can be preserved. Done means logs from each service remain separated instead of being merged.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.