简体   繁体   English

Express Gateway 启用日志

[英]Express Gateway enabling logs

I have below issues with Express Gateway logs: Express Gateway 日志存在以下问题:

  1. I have enabled Express Gateway logs according to their documentation, but I couldn't find any log file created under my gateway root.我已经根据他们的文档启用了 Express Gateway 日志,但是我找不到在我的网关根目录下创建的任何日志文件。
  2. When I start the gateway with below command it shows debug logs, but the changes that I do in gateway.config.yml config will not reflect in debug log.当我使用以下命令启动网关时,它会显示调试日志,但我在 gateway.config.yml 配置中所做的更改不会反映在调试日志中。

    LOG_LEVEL=debug npm start

  3. How do I add timestamp for the log entries?如何为日志条目添加时间戳?

Edited:编辑:

gateway.config.yml config values: gateway.config.yml 配置值:

pipelines: default: apiEndpoints: - api policies: - log: # policy name - action: # array of condition/actions objects #timestamp: true message: Test ${req.method} ${req.originalUrl} # parameter for log action # Uncomment key-auth: when instructed to in the Getting Started guide. - key-auth: - proxy: - action: serviceEndpoint: httpbin changeOrigin: true pipelines: default: apiEndpoints: - api policies: - log: # policy name - action: # array of condition/actions objects #timestamp: true message: Test ${req.method} ${req.originalUrl} # parameter for log action # Uncomment key-auth: when instructed to in the Getting Started guide. - key-auth: - proxy: - action: serviceEndpoint: httpbin changeOrigin: true when instructed to in the Getting Started guide. - key-auth: - proxy: - action: serviceEndpoint: httpbin changeOrigin: true

  1. Express Gateway has no way to store logs on files. Express Gateway 无法将日志存储在文件中。 While this is technically possible (We're using Winston under the hood so we would just need to put the right transport strategy) we haven't provided a way to enable it.虽然这在技术上是可行的(我们在幕后使用 Winston,因此我们只需要制定正确的传输策略),但我们还没有提供启用它的方法。 Right now you'd need to catch the log from the standard output and save them somewhere, using IO redirection in case you're on an UNIX system.现在您需要从标准 output 捕获日志并将它们保存在某个地方,如果您使用的是 UNIX 系统,则使用 IO 重定向。

  2. I'm not quite sure what you mean here.我不太确定你在这里的意思。 When you're doing some changes to the gateway.config file you should receive an info message telling you the hot reloading has completed.当您对gateway.config文件进行一些更改时,您应该会收到一条info消息,告诉您热重载已完成。 If you can elaborate more I can be more precise here如果您可以详细说明,我可以在这里更精确

  3. Unfortunately you can't.不幸的是你不能。 Our logging strategy is not exactly THAT configurable.我们的日志记录策略并不是完全配置的。 It might be worth to open an issue on our repository so we can prioritize these requests.在我们的存储库上打开一个问题可能是值得的,这样我们就可以优先考虑这些请求。

Thanks,谢谢,

V.五、

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM