而且在 config里面也配置了
logger: {
dir: '/home/front/项目名称/logs/',
现在的问题是,启动egg-scripts 的时候,还是会生成 两个文件夹,一个是 alinode 还有一个是 项目名称的文件夹,如下图,我想问的是,怎样才能 把$HOME/logs 这个文件夹转到我自己config里的dir目录去,需要那行配置吗?我没找到相关的说明。

Translation of this issue:
And also configured in the config
Logger: {
Dir: '/home/front/project name/logs/',
The problem is that when you start egg-scripts, you will still generate two folders, one is alinode and the other is the project name folder, as shown below, I want to ask, how can I put $HOME/logs this? The folder goes to the dir directory in my own config. Do I need that line configuration? I did not find the relevant instructions.

看 alinode 插件
@popomore 你好,我用egg-scripts 启动项目,并没有下载 egg-alinode 插件,${appInfo.root}/logs 下为什么还会生成 alinode日志,你说让我看 alinode插件,但是里面讲解的都是 线安装 egg-alinode 之后配置,我自己项目根本就没引用 egg-alinode,更何谈设置了,请问这种情况你遇到过吗?
谁来解决一下这个问题?
@popomore 你好,我用egg-scripts 启动项目,并没有下载 egg-alinode 插件,${appInfo.root}/logs 下为什么还会生成 alinode日志,你说让我看 alinode插件,但是里面讲解的都是 线安装 egg-alinode 之后配置,我自己项目根本就没引用 egg-alinode,更何谈设置了,请问这种情况你遇到过吗?
https://github.com/eggjs/egg-scripts/blob/master/lib/cmd/start.js#L123
这里只是创建了一个目录,但不会写日志进去。是这里困扰到你吗?
这里的 mkdir 逻辑挪到 egg-alinode 去会不会太晚了?还是 alinode 那边会自动建这个目录?
这里的 mkdir 逻辑挪到 egg-alinode 去会不会太晚了?还是 alinode 那边会自动建这个目录?
alinode 没有创建目录,这里显然是强行设置 ENABLE_NODE_LOG =YES (不管 runtime 是不是 alinode),理论上这一行的 mkdirp 应该放到 egg-alinode 插件里面,而不是 egg-scripts 里面吧
但 ENABLE_NODE_LOG 放到 egg-alinode 就晚了吧。
mkdirp 来个 PR 搞搞?
但 ENABLE_NODE_LOG 放到 egg-alinode 就晚了吧。
mkdirp 来个 PR 搞搞?
ENABLE_NODE_LOG 是得放到 egg-scripts 里面,当时只支持环境变量的方式局限性比较多,所以我现在搞的那个支持 js 传参了,这种场景下灵活一些。
不过我看这位同学的描述:
现在的问题是,启动egg-scripts 的时候,还是会生成 两个文件夹
显然并不只是这里 mkdirp alinode 文件夹造成的吧?
@atian25 我想了下,NODE_LOG_DIR 的创建也不能放到插件里,因为如果用的是 alinode runtime 的话,egg-scripts 一启动直接就开始写文件了
@llsldwy 要不试下启动前加上 MOCK_HOME_DIR=/path/to/your/project/logs 启动看下,我看了下这里的 home 目录判断在这里:
https://github.com/node-modules/node-homedir/blob/master/index.js#L6
用 MOCK_HOME_DIR 这个单测的桩环境变量感觉是可以改变这里的 logdir 指向的
我想了下,NODE_LOG_DIR 的创建也不能放到插件里,因为如果用的是 alinode runtime 的话,egg-scripts 一启动直接就开始写文件了
我上面提到了,放插件就很晚了。