Rails 5在生产模式下调试

时间:2023-01-16 09:44:26

I am trying to find a way to check logs or debug in production I am using passenger and apache and ubuntu as server. Every time I create any scaffold and upload it to server I get error : Rails 5在生产模式下调试

我试图找到一种方法来检查日志或调试生产我使用乘客和apache和ubuntu作为服务器。每次我创建任何脚手架并将其上传到服务器我都会收到错误:

I have used

我用过

 bundle exec rake  assets:precompile  RAILS_ENV=production

But getting no success but when I am running application using :

但是没有成功但是当我运行应用程序时使用:

 rails s -e production

I can access my controllers and views over port 3000. What is wrong with this why assets:precompile is not working properly I am adding JS files manually not using coffee script. And my javascripts files are not complied.

我可以通过端口3000访问我的控制器和视图。这有什么问题资产:预编译不正常我手动添加JS文件而不是使用咖啡脚本。我的javascripts文件没有被遵守。

My question is how can I set anything in production to see a debug like in development mode like this: Rails 5在生产模式下调试

我的问题是如何在生产中设置任何东西,以便在开发模式下看到像这样的调试:

Can I do this in production I am using rails 5

我可以在生产中使用rails 5

1 个解决方案

#1


1  

The production error you have shown above was a 404 error. it means that the route doesn't exist or there are no controllers methods for that route or is a model not found error.

您在上面显示的生产错误是404错误。这意味着该路由不存在或者该路由没有控制器方法,或者是找不到模型的错误。

As for adding debuggers in production, can you do it?

至于在生产中添加调试器,你能做到吗?

Yes you can.

是的你可以。

But should you do it?

但是你应该这样做吗?

NO, because it is a BAD practice. If you wish to view and debug errors in production, check your logs for the stacktrace and work with it from there. As long as it is a rails error, it will be in log/production.log.

不,因为这是一个不好的做法。如果您希望查看和调试生产中的错误,请检查您的日志以查找堆栈跟踪,并从那里开始使用它。只要是rails错误,它就会出现在log / production.log中。

#1


1  

The production error you have shown above was a 404 error. it means that the route doesn't exist or there are no controllers methods for that route or is a model not found error.

您在上面显示的生产错误是404错误。这意味着该路由不存在或者该路由没有控制器方法,或者是找不到模型的错误。

As for adding debuggers in production, can you do it?

至于在生产中添加调试器,你能做到吗?

Yes you can.

是的你可以。

But should you do it?

但是你应该这样做吗?

NO, because it is a BAD practice. If you wish to view and debug errors in production, check your logs for the stacktrace and work with it from there. As long as it is a rails error, it will be in log/production.log.

不,因为这是一个不好的做法。如果您希望查看和调试生产中的错误,请检查您的日志以查找堆栈跟踪,并从那里开始使用它。只要是rails错误,它就会出现在log / production.log中。