Russell Butek wrote:

> This is why I said Richard ALMOST convinced me.  Sure, log.debug is shorter
> to type than System.out.println.  But in order to use it I have to turn
> debugging on, and grep for my stuff in a potentially huge pile of output.
> And then when I'm done I have to remember to turn debugging back off so I
> don't accidentally commit my stuff with it turned on.  System.out.println
> sounds a whole lot easier.

hi,

there is a potential solution to this: allow runtime option to be specified that
will control what debug output is needed (by default all off). i have implemented
such approach in my minilogger that works as follow - if you run this:

    java -Dlog=foo:ALL foo.Foo

that will turn logging only for package "foo" and all its sub packages for all
levels (such as "foo.bar.Bar").

more flexibility is allowed:

    java -Dlog=:SEVERE,foo:FINE,foo.bar:ALL foo.Foo

it is interpreted as to show only log levels higher or equal to SEVERE for all
loggers but for "foo" and sub packages to show log level equal and higher than FINE
(that includes "foo.bar" and "foo.izzy". finally if logger has name "foo.bar.*" all
logging will be shown.

i found it extremely useful and very fast to change. be default all logging is off
so it is also very convenient to run tests etc.


for more details on syntax and more samples see documentation at:
    http://www.extreme.indiana.edu/~aslom/minilogger/
and if you are interested in  the code that is doing parsing of command line
parameter - it is located in Logger.java (available also online at
http://www.extreme.indiana.edu/~aslom/minilogger/v10/src/java/impl/soaprmi/util/logging/)

if you find it useful feel free to use it.

thanks,

alek


Reply via email to