ruby-on-rails - 无法在日志查看器中查看日志
问题描述
按照指南(GCE) 设置 Rails 应用程序以获取日志。但我只能在日志查看器中查看系统日志。在 Rails 控制台中运行以下命令时,
Rails.logger
谷歌云实例对象正在积极返回。
Followed the steps to interact with the Google Cloud Library
`
## Imports the Google Cloud client library
require "google/cloud/logging"
## Your Google Cloud Platform project ID
project_id = "test-rails"
## Instantiates a client
logging = Google::Cloud::Logging.new project: my_proid_56678
## Prepares a log entry
entry = logging.entry
## The data to log
entry.payload = "Hello, world!"
## The name of the log to write to
entry.log_name = "Dashboard log"
## The resource associated with the data
entry.resource.type = "global"
## Writes the log entry
logging.write_entries entry
puts "Logged #{entry.payload}" `
### But, the above lines are not been reflected in Logs viewer
解决方案
推荐阅读
- python - 在 Pandas 中用 0(零)填充缺失的日期
- azure - 如何在 azuredeploy 中使用选项和设置
- angular - Angular:如何以编程方式将 Base64 图像设置为 div 的背景图像
- java - 如何在发送之前在 HTML 文件中实现 Java 变量?
- batch-file - 将此批处理变量保存到 txt 文件中
- python - 有效地比较当月的运行总计和当月的总计
- selenium - Jenkins 中的 TestNG 结果趋势不显示失败的测试或构建
- tensorflow - 为什么归一化不需要参数,但批量归一化需要
- python - 每当将新对象放入 Azure 存储桶时触发 Azure Runbook
- visual-studio - .net 核心控制台应用程序解决方案在 Visual Studio Professional 2019 中创建新项目时没有项目条目