Why do rails register an empty string?

If I format the log message in Rails, I often get an empty string. For instance:

Started GET "/assets/jquery.ifixpng.js?body=1" for 127.0.0.1 at 2012-03-06 12:59:43 +0100 2012-03-06 12:59:43 INFO Served asset /jquery.ifixpng.js - 200 OK (26ms) 2012-03-06 12:59:43 INFO Started GET "/assets/logo.png" for 127.0.0.1 at 2012-03-06 12:59:43 +0100 2012-03-06 12:59:43 INFO Served asset /logo.png - 200 OK (26ms) 2012-03-06 12:59:43 INFO 

Custom mass_format

 class Logger def format_message(severity, timestamp, progname, msg) "#{timestamp.to_formatted_s(:db)} #{severity} #{msg}\n" end end 

How can I get rid of empty lines, for example 2012-03-06 12:59:43 INFO?

Have I checked msg.empty already? or msg.nil? but without any success. I also checked for \ n or \ r or \ n \ n or \ r \ r ...

+4
source share
1 answer

I think this is due to this change ( backing up the online archive ), to somewhat hush up the resource log messages.

0
source

Source: https://habr.com/ru/post/1400001/


All Articles