Sha256: 4a9e55e9ed2d0a850b2c6e6833f68863db5da9d8ec8d898e87245fbe01d1231b

Contents?: true

Size: 928 Bytes

Versions: 11

Compression:

Stored size: 928 Bytes

Contents

# How to use RollingFileOutputter

$: << "../src"
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" => true
}
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

11 entries across 11 versions & 3 rubygems

Version Path
sml-log4r-1.0.6 examples/fileroll.rb
log4r-1.1.7 examples/fileroll.rb
log4r-1.1.6 examples/fileroll.rb
log4r-1.1.5 examples/fileroll.rb
log4r-1.1.4 examples/fileroll.rb
log4r-1.1.3 examples/fileroll.rb
log4r-1.1.2 examples/fileroll.rb
log4r-1.1.1 examples/fileroll.rb
log4r-1.1.0 examples/fileroll.rb
log4r-1.0.6 examples/fileroll.rb
riess-0.0.8 vendor/log4r-1.0.5/examples/fileroll.rb