简体   繁体   English

如何在生产模式下查看错误 - nuxtjs

[英]How to see errors on production mode - nuxtjs

I think there are many questions about this.我认为这有很多问题。 But there isn't a correct answer.但是没有一个正确的答案。 How I can see detail of error logs on production mode?如何在生产模式下查看错误日志的详细信息?

在此处输入图像描述

Nuxt provides a flag to enable debugging on production in the nuxt.config.js file Nuxt 在nuxt.config.js文件中提供了一个标志来启用生产调试

{
  debug: true
}

You should be able the see the server logs from terminal you started the server(npm run start / nuxt start etc.).您应该能够从您启动服务器的终端查看服务器日志(npm run start / nuxt start 等)。 If you want the dev console in production mode, add this to your nuxt.config.js如果您希望开发控制台处于生产模式,请将其添加到您的 nuxt.config.js

  build: {
    terser:{
      terserOptions: {
        compress:{
          drop_console: false,
        },
      },
    },
  },

You should debug it locally before shipping to production because this may be fixable locally.您应该在交付生产之前在本地对其进行调试,因为这可能在本地可以修复。
Otherwise, Sentry / Logrocket are good solutions, on top of a whole testing CI.否则,在整个测试 CI 之上, Sentry / Logrocket是很好的解决方案。
A staging URL replicating the production environment is also a viable solution.复制生产环境的暂存 URL 也是一种可行的解决方案。

Otherwise, you should not have publicly visible logs accessible from the public.否则,您不应该让公众可以访问公开可见的日志。

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

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