Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ActiveSupport::BufferedLogger#silence is deprecated. If you want to…
… squelch logs for a certain block, change the log level for that block. * ActiveSupport::BufferedLogger#open_log is deprecated. This method should not have been public in the first place. * ActiveSupport::BufferedLogger's behavior of automatically creating the directory for your log file is deprecated. Please make sure to create the directory for your log file before instantiating. * ActiveSupport::BufferedLogger#auto_flushing is deprecated. Either set the sync level on the underlying file handle like this: f = File.open('foo.log', 'w') f.sync = true ActiveSupport::BufferedLogger.new f Or tune your filesystem. The FS cache is now what controls flushing. * ActiveSupport::BufferedLogger#flush is deprecated. Set sync on your filehandle, or tune your filesystem.
- Loading branch information
1 parent
f79b257
commit 04ef93d
Showing
6 changed files
with
96 additions
and
241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
04ef93d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One test broken in ActiveSupport :-)
04ef93d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in cd7fbcb.
04ef93d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the benefits provided by BufferredLogger was that log messages from one request would not interleave with log messages for different requests. Is there a replacement for this functionality?
04ef93d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It depends on what you want to achieve. If you just want to deal with production logs, then you should log the pid of your process. The default logger from stdlib will automatically log the PID for you, so you can use it instead:
Maybe we should switch to use it by default.
04ef93d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logging the PID would at least provide a way of sorting it out. The stdlib Logger's default format is pretty verbose and kinda haphazard. A syslog style for production, like the hodel_3000_compliant_logger gem uses, would make a nice core default. 👍
04ef93d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't get rationale behind all this. BufferedLogging with flushing after every request was really, I mean really useful. Much more useful than a little performance boost. Logging pids doesn't make it much more readable.
So, @tenderlove , was it simplifying things the point of that commit, or were there other concerns? I'm thinking about extracting old buffered logger (with autoflushing middleware) into separate gem. Is there something wrong with that idea you can warn me about?
04ef93d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess there were some issues that if application would crash in the middle of the request you would lose all the logging.
With that in mind I would still appreciate a decent way of choosing if I want to flush log after every requetst.
Filesystem tuning didn't seem a simple thing.
I guess File.sync is now always true: https://github.com/rails/rails/blob/3-2-stable/railties/lib/rails/application/bootstrap.rb#L33
Couldn't BufferedLogger have something like
def flush; log_dest.fsync; log_flushable_count = 0; end
and also auto flushing after some log_count. The default could be withauto_flush = 0
but it would be easy to set some linecount like it used to be.I'd rather have nicely outputted logs that I can use daily than the current way of having a mess that is useful with exception that happens once a year.
04ef93d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@codesnik @holli +1
What's the point of deprecating this?