You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
get_current_sequence_number() returns an invalid valid value if there is a file for which #{@core_file_name} ends with a digit and a second one being a prefix of the first.
For two log files named /my/path/file42.log and /my/path/file.log we will first create a /my/path/file42000001.log /my/path/file000001.log and later return 42000001 as the current maximum sequence number for file.log .
makeNewFilename will fail on line 137 with negative argument exception
padded_seq_no = "0" * (6 - @current_sequence_number.to_s.length) + @current_sequence_number.to_s
Thus, the regex is get_current_sequence_number() should be replaced with the more restrictive one from purge_log_files().
diff --git a/lib/log4r/outputter/rollingfileoutputter.rb b/lib/log4r/outputter/rollingfileoutputter.rb
index d8ecf0c..4cdd071 100644
--- a/lib/log4r/outputter/rollingfileoutputter.rb
+++ b/lib/log4r/outputter/rollingfileoutputter.rb
@@ -111,7 +111,7 @@ module Log4r
def get_current_sequence_number()
max_seq_no = 0
Dir.foreach(@log_dir) do |child|
- if child =~ /^#{@core_file_name}(\d+)#{@file_extension}$/
+ if child =~ /^#{@core_file_name}([0-9][0-9][0-9][0-9][0-9][0-9])#{@file_extension}$/
seq_no = $1.to_i
if (seq_no > max_seq_no)
max_seq_no = seq_no
The text was updated successfully, but these errors were encountered:
get_current_sequence_number() returns an invalid valid value if there is a file for which #{@core_file_name} ends with a digit and a second one being a prefix of the first.
For two log files named /my/path/file42.log and /my/path/file.log we will first create a /my/path/file42000001.log /my/path/file000001.log and later return 42000001 as the current maximum sequence number for file.log .
makeNewFilename will fail on line 137 with negative argument exception
padded_seq_no = "0" * (6 - @current_sequence_number.to_s.length) + @current_sequence_number.to_s
Thus, the regex is get_current_sequence_number() should be replaced with the more restrictive one from purge_log_files().
The text was updated successfully, but these errors were encountered: