Rails logger Get a rough idea in 1 minute

You can output logs from Rails code by using logger

Log storage location

Defaults to Rails.root/log/

Export to STDOUT (standard output)

config.logger = Logger.new(STDOUT)

You will be able to change the output format

config.log_formatter = ::Logger::Formatter.new

Set the log level you want to output

config.log_level = :error Uncontrollable errors such as fatal program crash error An error that can be controlled by the program warn warning info Information useful for system operation and management Information for debug developers Everything above the set level is displayed (if: error, fatal and error)

Tagged log output

logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT))

Recommended Posts

Rails logger Get a rough idea in 1 minute
Fargate to get a rough idea in relation to EC2
Get UserAgent in [Rails] controller
Add a search function in Rails.
Create a new app in Rails
Implement a contact form in Rails
Get stuck in a Java primer
How to insert a video in Rails
Get a rough idea of the differences between protocols, classes and structs!
Steps to set a favicon in Rails
[Ruby / Rails] Use alias. In a way that rubocop won't get angry!
Get weather forecast from OpenWeatherMap in Rails
[Rails] How to get rid of flash messages in a certain amount of time
Convert to a tag to URL string in Rails
How to implement a like feature in Rails
How to easily create a pull-down in Rails
(Ruby on Rails6) Creating data in a table
How to make a follow function in Rails
Rails Logger Basics
Group_by in Rails
One case of solving a migration error in Rails
How to implement a like feature in Ajax in Rails
I want to use a little icon in Rails
[Ruby / Rails] Set a unique (unique) value in the class
Get a list of classes in a Guava specific package
[How to insert a video in haml with Rails]
How to write a date comparison search in Rails
I want to define a function in Rails Console
[Rails 6] How to set a background image in Rails [CSS]
[Rails] How to load JavaScript in a specific view
Get location information in Rails and sort in ascending order
How to get started with creating a Rails app
What to do if you get a "302" error in your controller unit test code in Rails