Skip to content

Commit

Permalink
Add request information to 404s log messages
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-hank committed Sep 14, 2022
1 parent 869d1c3 commit 92b077c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). It uses [CalVer](https://calver.org/) as of May 2019.

## [22.09c](https://github.com/berkmancenter/lumendatabase/releases/tag/2022.09c) - 2022-09-14
### Added
* Added `request` information to `404s log messages`.

## [22.09b](https://github.com/berkmancenter/lumendatabase/releases/tag/2022.09b) - 2022-09-13
### Fixed
* Set the proper type for `jsonb` fields to correctly render in the `admin`.
Expand Down
13 changes: 12 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,18 @@ def routing_error

def resource_not_found(exception = false)
logger404s = Logger.new("#{Rails.root}/log/#{Rails.env}_404s.log")
logger404s.error(exception) if exception
if exception
logger404s.error(
format(
'Exception %s "%s" for %s at %s',
request.raw_request_method,
request.filtered_path,
request.remote_ip,
Time.now.to_default_s
)
)
logger404s.error(exception)
end

set_default_format

Expand Down

0 comments on commit 92b077c

Please sign in to comment.