如何覆盖日志级别?

How can I override log level?

我运行 Strapi 3.2.5 处于开发模式(strapi develop)。

我想将默认日志级别(调试)更改为更详细的级别(跟踪),以便解决我从 strapi 管理面板收到的服务器错误(例如 400 响应)。

当像此处文档中提到的那样覆盖 STRAPI_LOG_LEVEL 环境变量时,我收到此消息: debug STRAPI_LOG_LEVEL 环境变量被记录器中间件覆盖。它仅适用于 Strapi 的中间件上下文之外。

Strapi 的中间件上下文是什么?如果在我的情况下日志级别不可自定义,那么获取有关 400 响应原因的更多详细信息的解决方案是什么(无需侵入源代码)?

我在 Strapi 的社区论坛上得到了答案 here

see the middleware documentation for the logger here: https://strapi.io/documentation/v3.x/concepts/middlewares.html#request-middlewares

You will need to create (or update if the file already exists) the ./config/middleware.js file with the proper log level from here: https://strapi.io/documentation/v3.x/cli/CLI.html#strapi-start

So something like:

module.exports = {
 //...
   settings: {
   logger: {
     level: "trace",
   },
 },
 //...
};