G
Guillaume Guillaume
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...
By the way i'm running on windows XP.
The error:
Errno::EACCES Permission denied -
C:/rails_apps/fdc_psp_rails/log/development.log
The error is thrown from:
rolling_file.rb
def write( event )
str = event.instance_of?:Logging::LogEvent) ?
@layout.format(event) : event.to_s
return if str.empty?
--> @io.flock_sh { super(str) } <--
if roll_required?
@io.flock? {
@age_fn_mtime = nil
copy_truncate if roll_required?
}
@roller.roll_files
end
end
logging is integrated in rails environment.rb config likeso:
Logging.init :debug, :info, :warn, :error, :fatal
logger = Logging.logger.root
layout = Logging.layouts.patternpattern => '%d %l [%.20c] %m')
logger.add_appenders(
Logging.appenders.stdoutlayout => layout),
Logging.appenders.rolling_file(
"rolling_file",
:filename => "#{RAILS_ROOT}/log/#{RAILS_ENV}.log",
:age => 'daily',
:size => 2100000, # ~= 2mb
:layout => layout,
:level => :debug,
:safe => true
)
)
logger.level = :debug
config.logger = logger
I am using Mongrel but the rolling file also fails in webrick. The
result is that rolling_file logging level is set to ff...
Any help appreciated!
Thanks,
-Guillaume
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...
By the way i'm running on windows XP.
The error:
Errno::EACCES Permission denied -
C:/rails_apps/fdc_psp_rails/log/development.log
The error is thrown from:
rolling_file.rb
def write( event )
str = event.instance_of?:Logging::LogEvent) ?
@layout.format(event) : event.to_s
return if str.empty?
--> @io.flock_sh { super(str) } <--
if roll_required?
@io.flock? {
@age_fn_mtime = nil
copy_truncate if roll_required?
}
@roller.roll_files
end
end
logging is integrated in rails environment.rb config likeso:
Logging.init :debug, :info, :warn, :error, :fatal
logger = Logging.logger.root
layout = Logging.layouts.patternpattern => '%d %l [%.20c] %m')
logger.add_appenders(
Logging.appenders.stdoutlayout => layout),
Logging.appenders.rolling_file(
"rolling_file",
:filename => "#{RAILS_ROOT}/log/#{RAILS_ENV}.log",
:age => 'daily',
:size => 2100000, # ~= 2mb
:layout => layout,
:level => :debug,
:safe => true
)
)
logger.level = :debug
config.logger = logger
I am using Mongrel but the rolling file also fails in webrick. The
result is that rolling_file logging level is set to ff...
Any help appreciated!
Thanks,
-Guillaume