Skip to content
This repository was archived by the owner on Dec 8, 2020. It is now read-only.
This repository was archived by the owner on Dec 8, 2020. It is now read-only.

Logging message showing up as nil in online Timber console, but not STDOUT #1

@dmmcgee

Description

@dmmcgee

I am experiencing an issue trying to log with Timber from a Rails application. I am testing locally and have a source set up in the Timber console. Here is my config in initializers/timber.rb:

key = ENV['TIMBER_API_KEY'] || ' '
source = ENV['TIMBER_GCPORTAL_SOURCE_ID'] || ' '

if Rails.env.local?
  http_device = Timber::LogDevices::HTTP.new(key, source)
  Rails.logger = Timber::Logger.new(http_device, STDOUT)
else
  http_device = Timber::LogDevices::HTTP.new(key, source)
  Rails.logger = Timber::Logger.new(http_device)
end

As you can see I am logging to both the timber online console and my local STDOUT.

Take the following log line for example (although I am seeing this with all of my logging attempts):

Rails.logger.info("Malformed payload sent to #{@topic} topic: ", payload: @payload)

When this prints to STDOUT in my local environment, I see this message, which is what I expect:

{"level":"info","dt":"2019-07-29T04:34:44.772889Z","message":"Malformed payload sent to healthcheck topic: ","payload":{"token":"XXXXXX","type":"LAST_WILL","timestamp":"2019-07-28T23:54:06-04:00","body":{"healthcheck_key":"XXXXXXX","sent_time":3109926.657587}},"context":{"system":{"hostname":"Davids-MBP.home","pid":73677},"runtime":{"thread_id":70100616773980}}}

As you can see, the message field reads "Malformed payload sent to healthcheck topic: "

However, when views in the Timber.io console, this is what appears:

Screen Shot 2019-07-29 at 12 45 17 AM

Notice the message is showing up as nil.

Why the discrepancy, and how I can get my messages to properly show up in the timber.io online console?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions