0
0
Ruby on Railsframework~20 mins

Logging and monitoring in Ruby on Rails - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Logging and Monitoring Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Understanding Rails Logger Output Level
Given the following Rails logger configuration, what will be the output when a logger.debug message is logged?

config.log_level = :info
Ruby on Rails
logger.debug("Debug message")
AThe message will appear in the logs.
BThe message will NOT appear in the logs.
CThe logger will raise an error due to invalid log level.
DThe message will appear only if the environment is development.
Attempts:
2 left
💡 Hint
Remember that the log level filters out messages below its severity.
🧠 Conceptual
intermediate
1:30remaining
Purpose of Log Rotation in Rails
Why is log rotation important in a Rails application running in production?
ATo automatically delete all logs after each request.
BTo encrypt log files for security reasons.
CTo convert logs into database entries for faster access.
DTo prevent log files from growing indefinitely and consuming disk space.
Attempts:
2 left
💡 Hint
Think about disk space and log file size.
Troubleshoot
advanced
2:30remaining
Diagnosing Missing Logs in Production
A Rails app in production is not showing any logs for errors, even though errors occur. Which configuration issue is the most likely cause?
AThe <code>config.consider_all_requests_local</code> is set to <code>true</code>.
BThe <code>config.logger</code> is set to <code>Logger.new(STDOUT)</code>.
CThe <code>config.log_level</code> is set to <code>:fatal</code>.
DThe <code>config.log_tags</code> is missing.
Attempts:
2 left
💡 Hint
Check which log levels are recorded.
🔀 Workflow
advanced
3:00remaining
Setting Up Basic Monitoring for a Rails App
Which sequence of steps correctly describes setting up basic application monitoring using a tool like New Relic in a Rails app?
A1,2,3,4
B2,1,3,4
C1,3,2,4
D3,1,2,4
Attempts:
2 left
💡 Hint
Think about installation, configuration, restart, then verification.
Best Practice
expert
2:30remaining
Choosing the Best Logging Format for Production
Which logging format is best practice for a Rails production app to facilitate log aggregation and analysis?
AJSON formatted logs with structured fields.
BPlain text logs with custom delimiters.
CXML formatted logs for compatibility.
DBinary logs for performance.
Attempts:
2 left
💡 Hint
Consider ease of parsing by log management tools.