Sha256: 1ac59fed5a0d71429450b820e49910ba1c83d3b66301e7f969f60cbc22bc963c

Contents?: true

Size: 929 Bytes

Versions: 61

Compression:

Stored size: 929 Bytes

Contents

# How to use RollingFileOutputter

$: << "../lib"
require 'log4r'
include Log4r

puts "this will take a while"

# example of log file being split by time constraint 'maxtime'
config = {
  "filename" => "logs/TestTime.log",
  "maxtime" => 10,
  "trunc" => false
}
timeLog = Logger.new 'WbExplorer'
timeLog.outputters = RollingFileOutputter.new("WbExplorer", config)
timeLog.level = DEBUG

# log something once a second for 100 seconds
100.times { |t|
  timeLog.info "blah #{t}"
  sleep(1.0)
}

# example of log file being split by space constraint 'maxsize'
config = {
  "filename" => "logs/TestSize.log",
  "maxsize" => 16000,
  "trunc" => true
}
sizeLog = Logger.new 'WbExplorer'
sizeLog.outputters = RollingFileOutputter.new("WbExplorer", config)
sizeLog.level = DEBUG

# log a large number of times
100000.times { |t|
  sizeLog.info "blah #{t}"
}

puts "done! check the two sets of log files in logs/ (TestTime and TestSize)"

Version data entries

61 entries across 31 versions & 2 rubygems

Version Path
depengine-0.0.21 etc/isolate/ruby-1.8/gems/log4r-1.1.8/examples/fileroll.rb
depengine-0.0.21 etc/isolate/jruby-1.8/gems/log4r-1.1.8/examples/fileroll.rb
depengine-0.0.20 etc/isolate/ruby-1.8/gems/log4r-1.1.8/examples/fileroll.rb
depengine-0.0.20 etc/isolate/jruby-1.8/gems/log4r-1.1.8/examples/fileroll.rb
depengine-0.0.19 etc/isolate/jruby-1.8/gems/log4r-1.1.8/examples/fileroll.rb
depengine-0.0.19 etc/isolate/ruby-1.8/gems/log4r-1.1.8/examples/fileroll.rb
depengine-0.0.18 etc/isolate/jruby-1.8/gems/log4r-1.1.8/examples/fileroll.rb
depengine-0.0.18 etc/isolate/ruby-1.8/gems/log4r-1.1.8/examples/fileroll.rb
depengine-0.0.17 etc/isolate/ruby-1.8/gems/log4r-1.1.8/examples/fileroll.rb
depengine-0.0.17 etc/isolate/jruby-1.8/gems/log4r-1.1.8/examples/fileroll.rb
depengine-0.0.16 etc/isolate/jruby-1.8/gems/log4r-1.1.8/examples/fileroll.rb
depengine-0.0.16 etc/isolate/ruby-1.8/gems/log4r-1.1.8/examples/fileroll.rb
depengine-0.0.15 etc/isolate/ruby-1.8/gems/log4r-1.1.8/examples/fileroll.rb
depengine-0.0.15 etc/isolate/jruby-1.8/gems/log4r-1.1.8/examples/fileroll.rb
depengine-0.0.14 etc/isolate/jruby-1.8/gems/log4r-1.1.8/examples/fileroll.rb
depengine-0.0.14 etc/isolate/ruby-1.8/gems/log4r-1.1.8/examples/fileroll.rb
depengine-0.0.13 etc/isolate/ruby-1.8/gems/log4r-1.1.8/examples/fileroll.rb
depengine-0.0.13 etc/isolate/jruby-1.8/gems/log4r-1.1.8/examples/fileroll.rb
depengine-0.0.12 etc/isolate/jruby-1.8/gems/log4r-1.1.8/examples/fileroll.rb
depengine-0.0.12 etc/isolate/ruby-1.8/gems/log4r-1.1.8/examples/fileroll.rb