RE: AW: Performance and Logger.getLogger()

2003-04-02 Thread Shapira, Yoav

Howdy,
OK -- thanks for the information ;)

Yoav Shapira
Millennium ChemInformatics


>-Original Message-
>From: Ingo Adler [mailto:[EMAIL PROTECTED]
>Sent: Wednesday, April 02, 2003 2:47 PM
>To: Log4J Users List
>Subject: Re: AW: Performance and Logger.getLogger()
>
>Shapira, Yoav wrote:
>
>>Howdy,
>>Although we've resolved the original question, I have a related one:
has
>anyone tried using a FastHashMap or another of the commons-collections
>utilities to improve the performance of the logger lookup?
>>
>The logger lookup takes around 1 microsecond on a 900 Mhz PIII.
>Logging takes much longer ( >>10 times).
>
>I looked at the code of Hierarchy.getLogger, which seems to do the
work.
>It doesn't look as if you could simply plug in the FastHashMap and get
>it working like before. There are some synchronization issues.
>
>Ingo
>
>
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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



Re: AW: Performance and Logger.getLogger()

2003-04-02 Thread Ingo Adler
Shapira, Yoav wrote:

Howdy,
Although we've resolved the original question, I have a related one: has anyone tried 
using a FastHashMap or another of the commons-collections utilities to improve the 
performance of the logger lookup?
The logger lookup takes around 1 microsecond on a 900 Mhz PIII.
Logging takes much longer ( >>10 times).
I looked at the code of Hierarchy.getLogger, which seems to do the work.
It doesn't look as if you could simply plug in the FastHashMap and get 
it working like before. There are some synchronization issues.

Ingo



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


RE: AW: Performance and Logger.getLogger()

2003-04-02 Thread Shapira, Yoav

Howdy,
Although we've resolved the original question, I have a related one: has anyone tried 
using a FastHashMap or another of the commons-collections utilities to improve the 
performance of the logger lookup?

Yoav Shapira
Millennium ChemInformatics


>-Original Message-
>From: Ceki Gülcü [mailto:[EMAIL PROTECTED]
>Sent: Wednesday, April 02, 2003 9:51 AM
>To: Log4J Users List
>Subject: Re: AW: Performance and Logger.getLogger()
>
>At 04:41 PM 4/2/2003 +0200, you wrote:
>>Hey!
>>
>>Erik:
>>
>>The FAQ:
>>http://jakarta.apache.org/log4j/docs/FAQ.html
>>
>>
>>You are on the right track.
>>
>>The question is:
>>
>>{
>> Logger logger = Logger.getLogger("foo.bar");
>>
>> logger.warn("");
>> logger.error("");
>>
>>}(Good)
>
>yes. good.
>
>>vs.
>>{
>> Logger.getLogger("foo.bar").warn("");
>> Logger.getLogger("foo.bar").warn("");
>> Logger.getLogger("foo.bar").warn("");
>>}(Bad)
>
>yes, bad.
>
>Logger.getLogger("something") will essentially perform a look up on a
>hashtable. I don't think you could improve on this by keeping your own
>hashtable. There are ways where you could potentially improve on the lookup
>performance but this would require a really disproportionate amount of
>effort on your part.
>
>
>--
>Ceki
>
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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



Re: Performance and Logger.getLogger()

2003-04-02 Thread Erik Price


Shapira, Yoav wrote:

The situation he was talking about is different.  He's writing a logging façade, which will have methods like:

public static log(Class clazz, String message) {
  ...
}
And his question was about the cost of doing Logger.getLogger(clazz.getName()) each and every time inside the above method.  That can indeed get expensive.  It's like if you were doing Logger.getLogger() not in a static initializer, but every single time you needed to log something.
Oh, okay.  Thanks Yoav.  I still can't see how you figured that out from 
his post ;) but now that I know the context, his question makes complete 
sense.

Erik

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


Re: AW: Performance and Logger.getLogger()

2003-04-02 Thread Ceki Gülcü
At 04:41 PM 4/2/2003 +0200, you wrote:
Hey!

Erik:

The FAQ:
http://jakarta.apache.org/log4j/docs/FAQ.html
You are on the right track.

The question is:

{
Logger logger = Logger.getLogger("foo.bar");
logger.warn("");
logger.error("");
}(Good)
yes. good.

vs.
{
Logger.getLogger("foo.bar").warn("");
Logger.getLogger("foo.bar").warn("");
Logger.getLogger("foo.bar").warn("");
}(Bad)
yes, bad.

Logger.getLogger("something") will essentially perform a look up on a 
hashtable. I don't think you could improve on this by keeping your own 
hashtable. There are ways where you could potentially improve on the lookup 
performance but this would require a really disproportionate amount of 
effort on your part.

--
Ceki 

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


AW: Performance and Logger.getLogger()

2003-04-02 Thread Wulf Wechsung
Hey!

Erik:

The FAQ:
http://jakarta.apache.org/log4j/docs/FAQ.html


You are on the right track. 

The question is:

{
Logger logger = Logger.getLogger("foo.bar");

logger.warn("");
logger.error("");

}(Good)
vs.
{
Logger.getLogger("foo.bar").warn("");
Logger.getLogger("foo.bar").warn("");
Logger.getLogger("foo.bar").warn("");
}(Bad)




Yoav:

Oh, logger naming is not much of a problem (since the developers have no way
of assigning them). The individual services have well-formed names like
folder.subfolder:servicename, so I just replace the ':' by '.' and the log4j
hierachy works again.

Well, maybe I'll end up doing some performance meassuring myself, I'll let
everyone taking an interest know.

Thanks for the quick response :-)
Wulf

-Ursprungliche Nachricht-----
Von: Erik Price [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 2. April 2003 16:24
An: Log4J Users List
Betreff: Re: Performance and Logger.getLogger()




Wulf Wechsung wrote:

> I read in the faq that calling Logger.getLogger() will kill app
performance.
> I am currently writing a wrapper for a beast called the SAP/webMethod
> business connector which is an app-server providing a 'unique' flow
language
> to programm services. It would be to quite an effort to ask the developers
> of those services to keep references to their logger and pass it for each
> log statement, so I would did an implementation that determines which
logger
> to use by itself. Unfortunatly it has to call Logger.getLogger() for each
> log-call.

Hi Wulf,

I did not see this FAQ.  Can you post the URL so that I can read it too? 
  Currently I have a call to Logger.getLogger() in every class and the 
returned Logger is stored in a static field.  This is not the common way 
to acquire a logger?

Thank you,


Erik


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

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



RE: Performance and Logger.getLogger()

2003-04-02 Thread Shapira, Yoav

Howdy,

>  Currently I have a call to Logger.getLogger() in every class and the
>returned Logger is stored in a static field.  This is not the common way
>to acquire a logger?

This is the common way, and it's fine.  You're doing this one time.

The situation he was talking about is different.  He's writing a logging façade, which 
will have methods like:

public static log(Class clazz, String message) {
  ...
}

And his question was about the cost of doing Logger.getLogger(clazz.getName()) each 
and every time inside the above method.  That can indeed get expensive.  It's like if 
you were doing Logger.getLogger() not in a static initializer, but every single time 
you needed to log something.

Yoav Shapira
Millennium ChemInformatics



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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



Re: Performance and Logger.getLogger()

2003-04-02 Thread Erik Price


Wulf Wechsung wrote:

I read in the faq that calling Logger.getLogger() will kill app performance.
I am currently writing a wrapper for a beast called the SAP/webMethod
business connector which is an app-server providing a 'unique' flow language
to programm services. It would be to quite an effort to ask the developers
of those services to keep references to their logger and pass it for each
log statement, so I would did an implementation that determines which logger
to use by itself. Unfortunatly it has to call Logger.getLogger() for each
log-call.
Hi Wulf,

I did not see this FAQ.  Can you post the URL so that I can read it too? 
 Currently I have a call to Logger.getLogger() in every class and the 
returned Logger is stored in a static field.  This is not the common way 
to acquire a logger?

Thank you,

Erik

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


RE: Performance and Logger.getLogger()

2003-04-02 Thread Shapira, Yoav

Howdy,
You're in a difficult position ;(

My gut instinct says a map lookup will be faster than
Logger.getLogger(), so your idea about populating a map might be good.
Of course you will still have one Logger.getLogger() call for each
logger, but that's far better than calling it every time.

You also have to enforce a convention regarding logger naming, e.g. use
the class name for the logger name.  That may not be a big deal, as it's
a common convention anyways, but note that log4j by itself does not
require this convention.

Yoav Shapira
Millennium ChemInformatics


>-Original Message-
>From: Wulf Wechsung [mailto:[EMAIL PROTECTED]
>Sent: Wednesday, April 02, 2003 9:11 AM
>To: Log4j (E-Mail)
>Subject: Performance and Logger.getLogger()
>
>
>Hey!
>
>I read in the faq that calling Logger.getLogger() will kill app
>performance.
>I am currently writing a wrapper for a beast called the SAP/webMethod
>business connector which is an app-server providing a 'unique' flow
>language
>to programm services. It would be to quite an effort to ask the
developers
>of those services to keep references to their logger and pass it for
each
>log statement, so I would did an implementation that determines which
>logger
>to use by itself. Unfortunatly it has to call Logger.getLogger() for
each
>log-call.
>The question is: would application performance be better if I kept the
>Logger references in a hashtable and retrieved them from there by name?
>This might seem like an unnecessary question but I just don't know how
much
>over-heap there is involved when calling Logger.getLogger().
>
>Thanks in advance,
>Wulf
>
>PS:"I made a serious effort to see if this has been asked before via
the
>mail archives, so please excuse me if it, in fact, has been"
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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



Performance and Logger.getLogger()

2003-04-02 Thread Wulf Wechsung

Hey!

I read in the faq that calling Logger.getLogger() will kill app performance.
I am currently writing a wrapper for a beast called the SAP/webMethod
business connector which is an app-server providing a 'unique' flow language
to programm services. It would be to quite an effort to ask the developers
of those services to keep references to their logger and pass it for each
log statement, so I would did an implementation that determines which logger
to use by itself. Unfortunatly it has to call Logger.getLogger() for each
log-call. 
The question is: would application performance be better if I kept the
Logger references in a hashtable and retrieved them from there by name? 
This might seem like an unnecessary question but I just don't know how much
over-heap there is involved when calling Logger.getLogger().

Thanks in advance,
Wulf

PS:"I made a serious effort to see if this has been asked before via the
mail archives, so please excuse me if it, in fact, has been"

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