Skip to content

Commit

Permalink
fix: disable logrotator and avoid file exists error (#798)
Browse files Browse the repository at this point in the history
  • Loading branch information
czy88840616 committed Jan 10, 2021
1 parent f7aac5f commit 64ac85c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/web/config/plugin.js
Expand Up @@ -8,4 +8,5 @@ module.exports = {
enable: true,
package: 'midway-schedule',
},
logrotator: false,
};
6 changes: 5 additions & 1 deletion packages/web/src/logger.ts
Expand Up @@ -137,7 +137,11 @@ class EggLoggers extends BaseEggLoggers {
*/
constructor(options, app: Application) {
super(options);
this.app = app;
// 这么改是为了防止 egg 日志切割时遍历属性,导致报错
Object.defineProperty(this, 'app', {
value: app,
enumerable: false,
});
/**
* 由于 egg 的日志生成不是软链,每次都会创建,无法覆盖这个行为
* 1、如果以前存在老的 egg 日志,必然存在非软链文件,则重命名备份
Expand Down

0 comments on commit 64ac85c

Please sign in to comment.