Rails 3 seems to have had a property in config for changing the output location of Rails.logger
, config.log_path
. That's been deprecated. Looking at a Rails 6 application, is this the way to do that now? Or did this config property get moved to something new?
logger = ActiveSupport::Logger.new('log/blahblah.log')
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
In a Rails app, logs are stored under the /log folder. In development mode, the development. log file is used & you see log output on the terminal you're running rails server on.
To write in the current log use the logger. (debug|info|warn|error|fatal|unknown) method from within a controller, model, or mailer: logger. debug "Person attributes hash: #{@person.
log file. Rails uses six different log levels: debug, info, warn, error, fatal, and unknown. Each level defines how much information your application will log: Debug: diagnostic information for developers and system administrators, including database calls or inspecting object attributes.
Logger is a simple but powerful logging utility to output messages in your Ruby program. Logger has the following features: Print messages to different levels such as info and error. Auto-rolling of log files. Setting the format of log messages.
This will do the trick:
config.paths['log'] = 'log/new_log_file.log'
You can read more about paths here: https://api.rubyonrails.org/classes/Rails/Application/Configuration.html#method-i-paths
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With