log writing failed. closed stream using 3-2-stable #4668

Closed
lunks opened this Issue Jan 25, 2012 · 8 comments

Projects

None yet

3 participants

@lunks

After a couple of tweaks, I got 3-2-stable working on my app, but no output is logged to STDOUT. All that shows up is:

log writing failed. closed stream

Is there something I'm missing?

@tenderlove
Ruby on Rails member

We'll need more information to help debug this. Are you able to use the rails console? If so, do database queries get logged to stdout? Does it only happen on certain pages, or all pages?

@lunks

I'm using pry. Let me know if you need me to disable it.
It happens in all pages.
Console output:

[1] pry(main)> User.first
log writing failed. closed stream
log writing failed. closed stream
log writing failed. closed stream
log writing failed. closed stream
  User Load (1.6ms)  SELECT "users".* FROM "users" WHERE "users"."company_id" = 1 LIMIT 1
=> #<User id: 2, email: "excluido@email.com", encrypted_password: "$2a$10$oW.bFpUwJ8KXB5XQNonuyuCQRHjnmaQu...", reset_password_token: nil, remember_created_at: nil, sign_in_count: 0, current_sign_in_at: nil, last_sign_in_at: nil, current_sign_in_ip: nil, last_sign_in_ip: nil, password_salt: nil, failed_attempts: 0, locked_at: nil, username: "excluido", created_at: "2011-08-04 18:05:24", updated_at: "2011-08-04 18:05:47", state: "deleted", company_id: 1, profile_id: 1, external_id: nil, name: "Usuário excluído", organizational_chart_id: 49, cost_center_id: nil, admin: nil>
[2] pry(main)> 
@tenderlove
Ruby on Rails member

Can you do ls -alh on your development.log file? I'm starting to wonder if the permissions are correct.

@lunks

It is correct. Deleting it and letting Rails create it again didn't change anything.

-rw-r--r--  1 lunks  staff   6.1M Jan 25 15:29 log/development.log
@spovich

+1 on this problem with a 3-2-stable app in dev mode (ruby 1.9.2-p290) in webrick.

My log directory permissions are fine. I am trying to upgrade a 3.1.3 app to 3.2. I'm getting this on my 3-2-stable app (devise is broken in 3.2.0) for any asset served by webrick (dev mode).

I'm going to create a new 3-2 app and see if I can reproduce (maybe some config is missing in the upgraded app).

@lunks

spovich, we have debugged the issue on IRC. The problem happens here:
https://github.com/rails/rails/blob/3-2-stable/activesupport/lib/active_support/buffered_logger.rb#L30-42

We need to dupe @log_dest.dup. I'm already sending a pull request.

@spovich
@spovich

Confirming your PR fixes the problem for me! Thank you!

@carlosantoniodasilva carlosantoniodasilva pushed a commit to carlosantoniodasilva/rails that referenced this issue Jan 25, 2012
@lunks lunks Duping log handler. fixes #4668 c9cd0eb
@lunks lunks closed this Jan 25, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment