I have the following line in the log file:
D, [2022-11-18T14:38:31.281491 #1] DEBUG -- : [b34b78bf9c20007d0412dc57f1d1ba52] User excluded error: #<ActiveRecord::RecordNotFound: Couldn't find Hyrax::UploadedFile with 'id'=/app/samvera/branding/11aab197-b630-48c0-91cd-1578d42d9f53/logo/cropped-centeradventist_au_v_blue_website-1.jpg>
Let’s break this down “chunk by chunk”:
D,
: This is short-hand for the later DEBUG
. This line was written by Logger#debug
.[2022-11-18T14:38:31.281491 #1]
: The timestamp of the request; I’m uncertain what the #1
means.DEBUG -- :
: The logging message level sent; options are FATAL
, ERROR
, WARNING
, INFO
, DEBUG
. These are hierarchical. Loggers can configure to ignore lower level messages.[b34b78bf9c20007d0412dc57f1d1ba52]
: The request identifier. All log entries that have the same identifier were generated as part of the same request.User excluded error:…
: The logged message.For a great walk through of Ruby logging see Logging in Ruby with Logger and Lograge - Honeybadger Developer Blog.
Ripgrep or The Silver Searcher are excellent tools for reviewing and exploring logs.
In the above example, I can run rg "\[b34b78bf9c20007d0412dc57f1d1ba52\]"
on the downloaded log file. This gets me all logged entries for that particular request. Given that the application is logging multiple concurrent things, there's not guarantee that all of the same requests logged messages are contiguious.
Also consider the option of before (e.g. -B n
) and after (e.g. -A n
); where n
is an integer. This allows include and visualize the lines before and after each match.