Skip to content

Commit

Permalink
fix provided by David Siegal, File.size? returns nil, convert to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
colbygk committed Jun 8, 2010
1 parent e2dc481 commit e247e95
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/log4r/outputter/rollingfileoutputter.rb
Expand Up @@ -153,7 +153,7 @@ def open_log_file(mode)
@datasize = 0
else
@start_time = File.ctime(@filename)
@datasize = File.size?(@filename)
@datasize = File.size?(@filename) || 0 # File.size? returns nil even if the file exists but is empty; we convert it to 0.
end
@out = File.new(@filename, mode)
Logger.log_internal {"File #{@filename} opened with mode #{mode}"}
Expand Down

0 comments on commit e247e95

Please sign in to comment.