
Monitoring & Logging
Rails.logger, log levels, Sentry, New Relic, ActiveSupport::Notifications, tracing, correlation IDs, observability
1What is the default logger used in a Rails application?
What is the default logger used in a Rails application?
คำตอบ
Rails uses Rails.logger as the main access point to the logging system. By default, it is an instance of ActiveSupport::Logger that writes to files like log/development.log, log/production.log, etc., depending on the environment. This logger is automatically configured at application startup and is accessible from anywhere in the Rails code.
2What are the five log levels available in Rails, from least to most critical?
What are the five log levels available in Rails, from least to most critical?
คำตอบ
Rails uses five standard log levels: debug (detailed information for development), info (general operational information), warn (non-blocking warnings), error (recoverable errors), and fatal (critical errors causing shutdown). Each level filters out lower-level messages, allowing verbosity adjustment based on environment.
3How to configure the log level in production in Rails?
How to configure the log level in production in Rails?
คำตอบ
The production log level is configured in config/environments/production.rb via config.log_level. The default value is :info to avoid generating too much data in production. It is also possible to set the level dynamically via an environment variable like ENV.fetch('RAILS_LOG_LEVEL', 'info').to_sym for maximum flexibility without redeployment.
How to log a message with structured data in Rails to facilitate analysis?
What is the difference between Rails.logger.debug and Rails.logger.debug { } with a block?
+17 คำถามสัมภาษณ์
หัวข้อสัมภาษณ์ Ruby on Rails อื่นๆ
Ruby Basics
Ruby Object-Oriented Programming
Rails Fundamentals
Routing & Controllers
ActiveRecord Basics
Views & ERB Templates
ActiveRecord Associations
Advanced ActiveRecord Queries
Rails Forms
Authentication & Authorization
Modern Asset Pipeline & Frontend
Rails API Mode
Testing with RSpec
ActiveJob & Background Jobs
ActionCable & WebSockets
ActionMailer
ActiveStorage
Caching Strategies
Advanced Migrations
Rails Engines & Modular Apps
Performance Optimization
Rails Design Patterns
Ruby Metaprogramming
Rails Security
GraphQL with Rails
Deployment & Production
Rails Upgrade Strategies
เชี่ยวชาญ Ruby on Rails สำหรับการสัมภาษณ์ครั้งถัดไป
เข้าถึงคำถามทั้งหมด flashcards แบบทดสอบเทคนิค แบบฝึกหัด code review และตัวจำลองสัมภาษณ์
เริ่มใช้ฟรี