Skip to main content

服务器日志级别是 http

🌐 Server log level is http

你可以在配置中调整服务器日志级别,以控制在服务器日志中看到的详细信息量。如果你希望在服务器日志中看到更多或更少的详细日志,此功能允许你根据需求进行自定义。

🌐 You can adjust the server log level in the configuration to control how much detail you see in your server logs. If you want to see more or less verbose logs in your server logs, this feature allows you to customize it according to your needs.

此页面是重大更改数据库的一部分,提供关于重大更改的信息以及从 Strapi v4 迁移到 Strapi 5 的附加说明。

🌐 This page is part of the breaking changes database and provides information about the breaking change and additional instructions to migrate from Strapi v4 to Strapi 5.

 Is this breaking change affecting plugins?No
 Is this breaking change automatically handled by a codemod?No

重大变更描述

🌐 Breaking change description

在 Strapi v4 中

日志级别默认设置为 silly,这意味着会显示每一条日志,提供最详细的信息。

🌐 The log level defaults to silly, which means that every log is shown, providing the most detailed information.

在 Strapi 5 中

日志级别默认为 http。这意味着 sillydebug 级别的日志默认被隐藏,从而提供了较少冗长的日志输出。

🌐 The log level defaults to http. This means that sillyand debug level logs are hidden by default, offering a less verbose log output.

迁移

🌐 Migration

本节重新组合了有关引入的重大更改的有用说明和程序。

🌐 This section regroups useful notes and procedures about the introduced breaking change.

注意

🌐 Notes

日志级别可以在 server.js 文件中配置,如以下手动迁移部分所述,或者如 中间件配置 文档中所述。

🌐 The log level can be configured either in the server.js file as described in the following Manual migration section, or as described in the middlewares configuration documentation.

See the list of Winston log levels

手动迁移

🌐 Manual migration

要迁移到 Strapi 5:

🌐 To migrate to Strapi 5:

  1. 打开你的服务器配置文件(config/server)。
  2. 找到 { logger: { config: { level: 'debug' } } 部分。
  3. 将级别值修改为你所偏好的日志级别,例如 sillydebuginfowarnerror