From: Guillaume Guillaume Date: 2009-12-24T10:41:01+09:00 Subject: Re: logging, rolling file, permission denied Aldric Giacomoni wrote: > Guillaume Guillaume wrote: >> Hi, >> >> I'm trying out the excellent logging 1.3.0 gem inside my rails >> application. It works nicely with stdout and file appenders but I'm >> unable to using the rolling file appender config. After running some >> debug sessions I found out that the write fails due to i'm not sure >> what, I am certain that the file path is valid, so I conclude it must >> have to do with file locks... >> > > Are you trying to log .. Concurrently with the Rails log, or are you > trying to replace the default Rails logger with your own? > Look at this : > http://mikenaberezny.com/2007/02/24/rails-logging-tips/ > > Keeping this in mind: > One important point to remember is that the logfile object does not > implicitly flush to the file by default. This means that your code must > call logfile.flush for the data to be written out. Alternatively, you > can set logfile.sync = true to turn on implicit flushing. I am trying to replace Rails logger with the one from logging gem. There are no attempts to log concurrently as far as I'm aware. However my debugging session hints at 2 competing processes trying to log to the same rolling file. If I use the regular file appender I don't have that exception. Only the rolling file setup throws the exception. It's not a problem with flushing, the exception thrown causes the rolling file appender to get turned off with appender.level = :off. -- Posted via http://www.ruby-forum.com/.