无法在日志查看器中查看日志

时间:2020-01-29 09:52:39

标签: ruby-on-rails logging google-compute-engine stackdriver

遵循guide(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

0 个答案:

没有答案