框架 - Egg.js

日志问题

npm run start运行之后,注意看输出的日志保存地址,默认配置下并没有保存到项目文件夹中,而是保存到了根目录。

[egg-scripts] Save log file to C:\Users\licong23\logs
1

配置问题

使用脚手架快速搭建的项目,在config.default.js中修改日志dir配置没有生效。

module.exports = (appInfo) => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = (exports = {});

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1638953880850_2501';

  // add your middleware config here
  config.middleware = [];

  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
    logger: {
      dir: path.join(__dirname, 'logs', appInfo.name),
    },
  };

  return {
    ...config,
    ...userConfig,
  };
};
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Last Updated: 2023/2/20 16:42:16
Contributors: 黎聪, licong96