You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Vivek Kapadekar <vk...@bitfone.com> on 2003/06/09 18:13:44 UTC
Logger instance and performance
Hi All
I understand that the Logger instance that gets created depends on the
String that is passed to the static getLogger("some name") method of
Logger. And this String usually is same as FQN of the class. But, we
really do not need to use the FQN of the class , as our log messages
are not going to be used for debugging purpose, so it does not matter
from where they originated.
So if we pass the same string always say "Activity" to the getLogger()
method from every single class of our application, there will be One
and only one instance of Logger that will perform the logging . Is that
right ? if so, will it effect performance ? How about concurrency ?
Any suggestions ?
Thanks for the help
--Viv
Re: Logger instance and performance
Posted by Vivek Kapadekar <vk...@bitfone.com>.
We are leaning more towards using just One instance of Logger for the
entire application. Is that better in performance than having a Logger
instance per class?
On Mon, 2003-06-09 at 10:09, Ceki Gülcü wrote:
No definitely not. See the code in Hierarchy.getLogger method.
Also not that since Logger instances cannot be dereferenced, if you
continuously create logger instances, you will eventually run out of memory.
At 09:56 AM 6/9/2003 -0700, you wrote:
>I mean to say, whether I pass the same name to the getLogger() method (
>always returns the same instance ) , or I pass different names ( returns
>different instances) , the performance remains the same. Is that true?
>
>On Mon, 2003-06-09 at 09:39, Ceki Gülcü wrote:
>
> There is only one instance of Logger per a given name. Consequently,
> your
> question does not make sense to me.
>
> At 09:34 AM 6/9/2003 -0700, you wrote:
> >Oh OK. So does it mean that, as far as performance is concerned it does
> >not matter , whether there is one instance of Logger doing the logging,
> >or several Logger instances ?
> >
> >On Mon, 2003-06-09 at 09:29, Ceki Gülcü wrote:
> >
> > The Appender.doAppend method is syncronized for all appenders
> that are
> > shipped with log4j. See also the code in the
> > Category.callAppenders(LoggingEvent event) method. The
> synchronization
> > model has been improved in log4j 1.3.
> >
> > At 09:13 AM 6/9/2003 -0700, you wrote:
> >
> > >Hi All
> > >I understand that the Logger instance that gets created
> depends on the
> > >String that is passed to the static getLogger("some name")
> method of
> > >Logger. And this String usually is same as FQN of the
> class. But, we
> > >really do not need to use the FQN of the class , as our log
> messages
> > >are not going to be used for debugging purpose, so it does not
> matter
> > >from where they originated.
> > >So if we pass the same string always say "Activity" to the
> getLogger()
> > >method from every single class of our application, there will
> be One
> > >and only one instance of Logger that will perform the logging
> . Is that
> > >right ? if so, will it effect performance ? How about
> concurrency ?
> > >Any suggestions ?
> > >
> > >Thanks for the help
> > >
> > >--Viv
> >
> > --
> > Ceki For log4j documentation consider "The complete log4j manual"
> > ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: log4j-user-help@jakarta.apache.org
> >
> >
> >
>
> --
> Ceki For log4j documentation consider "The complete log4j manual"
> ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: log4j-user-help@jakarta.apache.org
>
>
>
--
Ceki For log4j documentation consider "The complete log4j manual"
ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org
Re: Logger instance and performance
Posted by Ceki Gülcü <ce...@qos.ch>.
No definitely not. See the code in Hierarchy.getLogger method.
Also not that since Logger instances cannot be dereferenced, if you
continuously create logger instances, you will eventually run out of memory.
At 09:56 AM 6/9/2003 -0700, you wrote:
>I mean to say, whether I pass the same name to the getLogger() method (
>always returns the same instance ) , or I pass different names ( returns
>different instances) , the performance remains the same. Is that true?
>
>On Mon, 2003-06-09 at 09:39, Ceki Gülcü wrote:
>
> There is only one instance of Logger per a given name. Consequently,
> your
> question does not make sense to me.
>
> At 09:34 AM 6/9/2003 -0700, you wrote:
> >Oh OK. So does it mean that, as far as performance is concerned it does
> >not matter , whether there is one instance of Logger doing the logging,
> >or several Logger instances ?
> >
> >On Mon, 2003-06-09 at 09:29, Ceki Gülcü wrote:
> >
> > The Appender.doAppend method is syncronized for all appenders
> that are
> > shipped with log4j. See also the code in the
> > Category.callAppenders(LoggingEvent event) method. The
> synchronization
> > model has been improved in log4j 1.3.
> >
> > At 09:13 AM 6/9/2003 -0700, you wrote:
> >
> > >Hi All
> > >I understand that the Logger instance that gets created
> depends on the
> > >String that is passed to the static getLogger("some name")
> method of
> > >Logger. And this String usually is same as FQN of the
> class. But, we
> > >really do not need to use the FQN of the class , as our log
> messages
> > >are not going to be used for debugging purpose, so it does not
> matter
> > >from where they originated.
> > >So if we pass the same string always say "Activity" to the
> getLogger()
> > >method from every single class of our application, there will
> be One
> > >and only one instance of Logger that will perform the logging
> . Is that
> > >right ? if so, will it effect performance ? How about
> concurrency ?
> > >Any suggestions ?
> > >
> > >Thanks for the help
> > >
> > >--Viv
> >
> > --
> > Ceki For log4j documentation consider "The complete log4j manual"
> > ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: log4j-user-help@jakarta.apache.org
> >
> >
> >
>
> --
> Ceki For log4j documentation consider "The complete log4j manual"
> ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: log4j-user-help@jakarta.apache.org
>
>
>
--
Ceki For log4j documentation consider "The complete log4j manual"
ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org
Re: Logger instance and performance
Posted by Vivek Kapadekar <vk...@bitfone.com>.
I mean to say, whether I pass the same name to the getLogger() method (
always returns the same instance ) , or I pass different names ( returns
different instances) , the performance remains the same. Is that true?
On Mon, 2003-06-09 at 09:39, Ceki Gülcü wrote:
There is only one instance of Logger per a given name. Consequently, your
question does not make sense to me.
At 09:34 AM 6/9/2003 -0700, you wrote:
>Oh OK. So does it mean that, as far as performance is concerned it does
>not matter , whether there is one instance of Logger doing the logging,
>or several Logger instances ?
>
>On Mon, 2003-06-09 at 09:29, Ceki Gülcü wrote:
>
> The Appender.doAppend method is syncronized for all appenders that are
> shipped with log4j. See also the code in the
> Category.callAppenders(LoggingEvent event) method. The synchronization
> model has been improved in log4j 1.3.
>
> At 09:13 AM 6/9/2003 -0700, you wrote:
>
> >Hi All
> >I understand that the Logger instance that gets created depends on the
> >String that is passed to the static getLogger("some name") method of
> >Logger. And this String usually is same as FQN of the class. But, we
> >really do not need to use the FQN of the class , as our log messages
> >are not going to be used for debugging purpose, so it does not matter
> >from where they originated.
> >So if we pass the same string always say "Activity" to the getLogger()
> >method from every single class of our application, there will be One
> >and only one instance of Logger that will perform the logging . Is that
> >right ? if so, will it effect performance ? How about concurrency ?
> >Any suggestions ?
> >
> >Thanks for the help
> >
> >--Viv
>
> --
> Ceki For log4j documentation consider "The complete log4j manual"
> ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: log4j-user-help@jakarta.apache.org
>
>
>
--
Ceki For log4j documentation consider "The complete log4j manual"
ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org
Re: Logger instance and performance
Posted by Ceki Gülcü <ce...@qos.ch>.
There is only one instance of Logger per a given name. Consequently, your
question does not make sense to me.
At 09:34 AM 6/9/2003 -0700, you wrote:
>Oh OK. So does it mean that, as far as performance is concerned it does
>not matter , whether there is one instance of Logger doing the logging,
>or several Logger instances ?
>
>On Mon, 2003-06-09 at 09:29, Ceki Gülcü wrote:
>
> The Appender.doAppend method is syncronized for all appenders that are
> shipped with log4j. See also the code in the
> Category.callAppenders(LoggingEvent event) method. The synchronization
> model has been improved in log4j 1.3.
>
> At 09:13 AM 6/9/2003 -0700, you wrote:
>
> >Hi All
> >I understand that the Logger instance that gets created depends on the
> >String that is passed to the static getLogger("some name") method of
> >Logger. And this String usually is same as FQN of the class. But, we
> >really do not need to use the FQN of the class , as our log messages
> >are not going to be used for debugging purpose, so it does not matter
> >from where they originated.
> >So if we pass the same string always say "Activity" to the getLogger()
> >method from every single class of our application, there will be One
> >and only one instance of Logger that will perform the logging . Is that
> >right ? if so, will it effect performance ? How about concurrency ?
> >Any suggestions ?
> >
> >Thanks for the help
> >
> >--Viv
>
> --
> Ceki For log4j documentation consider "The complete log4j manual"
> ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: log4j-user-help@jakarta.apache.org
>
>
>
--
Ceki For log4j documentation consider "The complete log4j manual"
ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org
Re: Logger instance and performance
Posted by Vivek Kapadekar <vk...@bitfone.com>.
Oh OK. So does it mean that, as far as performance is concerned it does
not matter , whether there is one instance of Logger doing the logging,
or several Logger instances ?
On Mon, 2003-06-09 at 09:29, Ceki Gülcü wrote:
The Appender.doAppend method is syncronized for all appenders that are
shipped with log4j. See also the code in the
Category.callAppenders(LoggingEvent event) method. The synchronization
model has been improved in log4j 1.3.
At 09:13 AM 6/9/2003 -0700, you wrote:
>Hi All
>I understand that the Logger instance that gets created depends on the
>String that is passed to the static getLogger("some name") method of
>Logger. And this String usually is same as FQN of the class. But, we
>really do not need to use the FQN of the class , as our log messages
>are not going to be used for debugging purpose, so it does not matter
>from where they originated.
>So if we pass the same string always say "Activity" to the getLogger()
>method from every single class of our application, there will be One
>and only one instance of Logger that will perform the logging . Is that
>right ? if so, will it effect performance ? How about concurrency ?
>Any suggestions ?
>
>Thanks for the help
>
>--Viv
--
Ceki For log4j documentation consider "The complete log4j manual"
ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org
Re: Logger instance and performance
Posted by Ceki Gülcü <ce...@qos.ch>.
The Appender.doAppend method is syncronized for all appenders that are
shipped with log4j. See also the code in the
Category.callAppenders(LoggingEvent event) method. The synchronization
model has been improved in log4j 1.3.
At 09:13 AM 6/9/2003 -0700, you wrote:
>Hi All
>I understand that the Logger instance that gets created depends on the
>String that is passed to the static getLogger("some name") method of
>Logger. And this String usually is same as FQN of the class. But, we
>really do not need to use the FQN of the class , as our log messages
>are not going to be used for debugging purpose, so it does not matter
>from where they originated.
>So if we pass the same string always say "Activity" to the getLogger()
>method from every single class of our application, there will be One
>and only one instance of Logger that will perform the logging . Is that
>right ? if so, will it effect performance ? How about concurrency ?
>Any suggestions ?
>
>Thanks for the help
>
>--Viv
--
Ceki For log4j documentation consider "The complete log4j manual"
ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org