Jamie Tsao wrote:
> 
> 1)  How do you turn off logging completely in the properties file ?
>
Check the javadoc for the field BasicConfigurator.DISABLE_KEY. 
Including a property like

   log4j.disable=INFO

will disable everything all INFO and DEBUG messages (and makes them very
efficient to pass over so long as the input parameter evaluation doesn't
take long).  To disable everything use

   log4j.disable=FATAL

You can override the log4j.disable with the log4j.disableOverride
property

   log4j.disableOverride=true

which effectively disables the disable.  The may seem silly at first. 
Keep in mind that the disableOverride was available to property files
long before disable.  It was expected that disable would be set
programmatically  for shipped code.  When it was necessary to debug
shipped code, the disableOverride would be set.  There was some demand
to reap the benefit of disable without having to do it
programmatically.  Hence disable property recognition was added to
PropertyConfigurator.

> 2)  Although I do see the nice benefits of having a hierarchical category
> name space, is it common (or recommended) that I write a single Logging
> class on top of log4j so that my entire application only uses one Category ?
>   Then throughout the code, I would selectively have different priority
> logging statements which I could filter during runtime (w/ disable() method
> calls).
Using different categories for different sections of code give you
another dimension in which to control your logging (the first one being
priorities).  By having different components, packages, classes or
whatever use different categories (suitably arranged in a hierarchy),
you may enable logging in various sections of your code independently.

-Paul

-- 
Beware of bugs in the above code.  I have
only proved it correct, not tried it.
-Don Knuth

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to