Rails Logger Basics

Implementation method

How to output

##How to output
Logger.new("Output destination", 'Output contents')

ex) Logger.new('/log/development', "Output contents")

##There seems to be such a way of writing

logger = Logger.new('/log/development')
logger.debug 'What you want to output'

When it is logged by the method to output, label? Is different.

By changing this label, I feel like changing the settings of the detection tool (I'm not sure about the infrastructure environment).

## logger.debug 'What you want to output'in the case of

D, [2020-10-04T08:41:46.184230 #6] DEBUG -- :Will it be output?

##logger.info 'What you want to output'

I, [2020-10-04T08:43:51.453817 #6]  INFO -- :Will it be output?

Output destination

Under log directory

If the location of the first argument of Logger does not exist, it will be newly created.

Logger.new('/log/hello.log', "hello")

Recommended Posts

Rails Logger Basics
Rails basics
Rails CSV basics
Rails Routing Basics
Rails database basics
Rspec Basics [Rails]
Ruby on Rails basics
[Rails] Introduction of devise Basics
[Rails g.error]
Rails Review 1
Ruby basics
Ruby basics
[Rails] first_or_initialize
rails tutorial
Fragment basics
JPA Basics 1
About Rails 6
Docker basics
ViewPager basics
Rails foundation
Rails memorandum
rails tutorial
Java basics
rails tutorial
rails tutorial
Java basics
RSpec Basics
Rails Basics of creating a new application
JavaScript basics
[Rails] devise
rails tutorial
JPA Basics 2
rails tutorial
Hash basics
Java basics
Rails Tips
rails method
rails tutorial
Ruby basics
[Rails] ActiveRecord
[Rails] form_with
RecyclerView Basics
Rails Review 2
Ruby on Rails ~ Basics of MVC and Router ~
Rails logger Get a rough idea in 1 minute