Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Message is not sent if shutdown immediately

未关闭
#6 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
领域
backend

调研方向

先从 Slack appender 和链接的 feature-support-shutdown 对比开始,然后检查 log4js.shutdown() 如何检查是否支持 shutdown。验证立即终止示例和建议的 callback 行为;当 Slack 请求可以完成,或在进程退出前获得建议的等待时间时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

Overview

Since this module doesn't have shutdown function, request to slack is not reached if log4js.shutdown() is called and process is terminated right after message event.

For example:
https://github.com/expressjs/generator/blob/master/templates/js/www.ejs#L68
When I replace this logging with log4js + slack appender, it will not notify to slack.
Even if I put process.exit(1) within shutdown callback like

const log4js = require('log4js');
const logger = log4js.getLogger();

logger.error(bind + ' requires elevated privileges');
log4js.shutdown(() => {
  process.exit(1);
});

it still won't wait process.exit() since slack appender doesn't support it.

As seen in log4js-node, it checks function existence.
https://github.com/log4js-node/log4js-node/blob/master/lib/log4js.js#L117

Appendix

If following proposal diff looks good, I'll make Pull Req.
https://github.com/log4js-node/slack/compare/master...honeroku:feature-support-shutdown

It doesn't guarantee that all request is done, but I suppose 1sec is enough (or even too much) for slack api.
And I don't want over-decorate this tiny module, so I made minimum support.

主要语言
JavaScript
星标
8
派生
8
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

log4js-node/slack 的其他 Issue

查看 log4js-node/slack 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。