At 06:50 22.02.2001 -0800, Scruffles - wrote:
>We are just beginning to replace our old logging
>system with Log4J.  So far it's been great.  I have
>one question though:  
>
>We have trace messages at the beginning and end of key
>methods. We use them to track lags in parts of our
>system as well as for debugging.  Although I don't
>think they are entirely necessary, I don't think I
>will be able to articulate a good argument.  Rather
>than fighting this, I would like a nice clean way to
>turn them off.  I have thought about a couple
>solutions.  Which is more correct:
>
>1.  to extend Priority to include a TRACE type (I
>assume this was left out for a reason)

That's a reasonable option. 

>2.  to use DEBUG for these trace messages and INFO for
>our typical debugging messages.  This would let me
>turn off all trace messages, and leave debugging
>(INFO) on.

I think that's a bad idea. INFO is for rather high level informational messages.

>3.  create a root category for trace messages (much
>like we will be doing for XML and SQL).  Categories
>would look like this:  TRACE.com.mycompany.mypackage
>(our sql statements will be written to
>SQL.com.mycompany.mypackage)
>
>Any suggestions?

Option 5) 

How about a second "method" category in the class files that have important methods 
logged at entry/exit?

class Foo {

  static Category cat  = Category.getInstance(Foo);
  static Category mcat = Category.getInstance(Foo.class.getName()+".method");

  public 
  void bar1() {
    mcat.debug("Entering bar1");
    ...
    mcat.debug("Exiting  bar1");
  }  

}

You can set the priority of the "Foo" and "Foo.method" categories separately.

Option 5) Do nothing. 

Method entry and exit points are just logging statements like any other...

Cheers, Ceki


----
Ceki Gülcü          Web:   http://qos.ch      
av. de Rumine 5     email: [EMAIL PROTECTED] (preferred)
CH-1005 Lausanne           [EMAIL PROTECTED]
Switzerland         Tel: ++41 21 351 23 15


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

Reply via email to