> > My solution works, but I wonder whether I could make it simpler
> > (i.e. without creating the NullOutputter class).
> >
> 
> Certainly. Just create an instance of Outputter and then define the
> methods you need.
> 
> out = Outputter.new 'tfwnull'
> class << out
>   def canonical_log(logevent) nil end
> end

Now I wonder, since Outputter is documented as *abstract* class, why
I can instantiate it at all? Or is "abstract class" in Ruby not dealt
with the same strength as in, say, Java or C++?

But anyway, I tried your approach, but I don't see how I get the
instance
of the anonymous class into my outputters. When I do it like this:

#!/usr/bin/ruby
require 'log4r'
include Log4r
$log=Logger.new('testing')
out = Outputter.new 'tfwnull'
$log.outputters=class << out
     def canonical_log(logevent) nil end
   end

I get the error message

  "Expected kind of Outputter, got NilClass (TypeError)"

Ronald

> 
> The canonical_log method is used by the outputters to format the log
> event and then write the formatted output to a file. By setting this
> to have a nil body, you will save a few cycles each time a log
> messages needs to be generated.
> 
> Another options is just to set the global log level to 'off'. That is
> left as an exercise for the reader ;-)
> 
> Blessings,
> TwP
> 
>