rails/rails — pull request #17700 by ShunsukeAida (2014-11-21 05:12:17+00:00)
Title: why not gitignore /log as a whole?

I'm sending this pull request partly because I'd like to know what is the rationale behind the extension limitation, but this has apparently stayed at least for 5 years, and people may be not enable to recall such an ancient story. I couldn't find any discussion about this, for that matter.

Anyway, the other day I realized I'd been sending a chunk of log files to a remote server, since I customized the output of logs (like `config.logger = Logger.new(config.paths["log"].first, 'daily')`), yet left `.gitignore` unchanged. With the default implementation, we could push logfiles like ` *.log.n` or ` *.log.yyyymmdd` to the remote repository, and it may result in leakage of personal information. Your name could be exposed even when you want anonymity, for instance.
> Missing template test/index, application/index with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :jbuilder]}. Searched in: * "C:/Users/John Smith/Desktop/rails_app/app/views"

The comment in the code states "Ignore ALL the logfiles", but the implementation is "` *.log` only". They just contradict each other, and I'm with what the comment expects, because logs are just logs and I can't think of a case where such a pretty environment-specific stuff by nature has to be shared, but if any, it should be manually picked up by users.

If those extensions are merely added by a third party gem I'd not bother to change the Rails itself, but it's actually a built-in feature of [Ruby's `Logger` class](http://www.ruby-doc.org/stdlib-2.1.5/libdoc/logger/rdoc/Logger.html#class-Logger-label-How+to+create+a+logger) which `ActiveSupport::Logger` thinly wraps, so I guess it doesn't hurts Rails cares about this matter.

For what it's worth, GitHub provides [a gitignore template for Rails](https://github.com/github/gitignore/blob/master/Rails.gitignore#L4) which also blacklists `/log`.

All in all, I guess either of the code or the comment should be corrected, because of the contradiction.