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 DeMZed <de...@gmail.com> on 2005/12/22 11:22:15 UTC

Difference between LogFactory.getLog & Logger.getLogger ?

Hi !

One is from org.apache.commons.logging and the other from org.apache.log4j.

It seems that those two clases does the same work, so, which one choose ?

Thanks :-)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Difference between LogFactory.getLog & Logger.getLogger ?

Posted by DeMZed <de...@gmail.com>.
Thanks for your help :)

2005/12/23, Mark Womack <mw...@apache.org>:
> commons-logging is not part of the Logging Services or log4j project, it is
> part of the Jakarta project.  Plus commons-logging can be used to wrap
> around other logging frameworks, like the JDK logging api (which makes it
> more usable in my opinion).  If you think your project might need to swap
> out the logging framework at some point, then commons-logging might be for
> you.  You can still get the power of log4j underneath it in the
> configuration of appenders, etc.
>
> There can be some issues with commons-logging though in the way it looks for
> the underlying framework, etc.  The links that Curt sent in his email are
> pretty clear about it.
>
> hth,
> -Mark
>
> ----- Original Message -----
> From: "DeMZed" <de...@gmail.com>
> To: "Log4J Users List" <lo...@logging.apache.org>
> Sent: Thursday, December 22, 2005 11:06 AM
> Subject: Re: Difference between LogFactory.getLog & Logger.getLogger ?
>
>
> Thanks :)
>
> If the use of the first in one class and the second in another class
> would not produce any diffrence, why isn't there only one use ?
>
> 2005/12/22, Mark Womack <mw...@apache.org>:
> > It depends on which package you want to use in your code.  If you only
> > want to reference loggers via commons-logging, use the commons logging
> > one.  If you want to reference loggers via log4j, use the log4j one.
> >
> > Even though commons-logging can use log4j under the covers, it does
> > not directly expose the log4j logger class and its methods (though
> > they are very, very similar).
> >
> > hth,
> > -Mark
> >
> > On 12/22/05, DeMZed <de...@gmail.com> wrote:
> > > Hi !
> > >
> > > One is from org.apache.commons.logging and the other from
> > > org.apache.log4j.
> > >
> > > It seems that those two clases does the same work, so, which one choose
> > > ?
> > >
> > > Thanks :-)
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > > For additional commands, e-mail: log4j-user-help@logging.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Difference between LogFactory.getLog & Logger.getLogger ?

Posted by Mark Womack <mw...@apache.org>.
commons-logging is not part of the Logging Services or log4j project, it is 
part of the Jakarta project.  Plus commons-logging can be used to wrap 
around other logging frameworks, like the JDK logging api (which makes it 
more usable in my opinion).  If you think your project might need to swap 
out the logging framework at some point, then commons-logging might be for 
you.  You can still get the power of log4j underneath it in the 
configuration of appenders, etc.

There can be some issues with commons-logging though in the way it looks for 
the underlying framework, etc.  The links that Curt sent in his email are 
pretty clear about it.

hth,
-Mark

----- Original Message ----- 
From: "DeMZed" <de...@gmail.com>
To: "Log4J Users List" <lo...@logging.apache.org>
Sent: Thursday, December 22, 2005 11:06 AM
Subject: Re: Difference between LogFactory.getLog & Logger.getLogger ?


Thanks :)

If the use of the first in one class and the second in another class
would not produce any diffrence, why isn't there only one use ?

2005/12/22, Mark Womack <mw...@apache.org>:
> It depends on which package you want to use in your code.  If you only
> want to reference loggers via commons-logging, use the commons logging
> one.  If you want to reference loggers via log4j, use the log4j one.
>
> Even though commons-logging can use log4j under the covers, it does
> not directly expose the log4j logger class and its methods (though
> they are very, very similar).
>
> hth,
> -Mark
>
> On 12/22/05, DeMZed <de...@gmail.com> wrote:
> > Hi !
> >
> > One is from org.apache.commons.logging and the other from 
> > org.apache.log4j.
> >
> > It seems that those two clases does the same work, so, which one choose 
> > ?
> >
> > Thanks :-)
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Difference between LogFactory.getLog & Logger.getLogger ?

Posted by Curt Arnold <ca...@apache.org>.
On Dec 22, 2005, at 1:06 PM, DeMZed wrote:

> Thanks :)
>
> If the use of the first in one class and the second in another class
> would not produce any diffrence, why isn't there only one use ?

They could produce radically different results depending on how they  
are configured.  commons-logging presents an API which can be  
redirected to log4j, JDK 1.4 logging, or other logging systems.  If  
common-logging is configured to redirect to log4j, then things work  
the same.  However, if it is redirected to JDK 1.4 logging, the log  
requests that use the log4j API would go to log4j and the log  
requests that use commons-logging would go to the JDK 1.4 logging.

See the description of commons-logging at http://jakarta.apache.org/ 
commons/logging/.  Also, if you are interested in issues with commons- 
logging, see http://www.qos.ch/logging/thinkAgain.jsp and http:// 
www.qos.ch/logging/classloader.jsp and 

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Difference between LogFactory.getLog & Logger.getLogger ?

Posted by DeMZed <de...@gmail.com>.
Thanks :)

If the use of the first in one class and the second in another class
would not produce any diffrence, why isn't there only one use ?

2005/12/22, Mark Womack <mw...@apache.org>:
> It depends on which package you want to use in your code.  If you only
> want to reference loggers via commons-logging, use the commons logging
> one.  If you want to reference loggers via log4j, use the log4j one.
>
> Even though commons-logging can use log4j under the covers, it does
> not directly expose the log4j logger class and its methods (though
> they are very, very similar).
>
> hth,
> -Mark
>
> On 12/22/05, DeMZed <de...@gmail.com> wrote:
> > Hi !
> >
> > One is from org.apache.commons.logging and the other from org.apache.log4j.
> >
> > It seems that those two clases does the same work, so, which one choose ?
> >
> > Thanks :-)
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Difference between LogFactory.getLog & Logger.getLogger ?

Posted by Mark Womack <mw...@apache.org>.
It depends on which package you want to use in your code.  If you only
want to reference loggers via commons-logging, use the commons logging
one.  If you want to reference loggers via log4j, use the log4j one.

Even though commons-logging can use log4j under the covers, it does
not directly expose the log4j logger class and its methods (though
they are very, very similar).

hth,
-Mark

On 12/22/05, DeMZed <de...@gmail.com> wrote:
> Hi !
>
> One is from org.apache.commons.logging and the other from org.apache.log4j.
>
> It seems that those two clases does the same work, so, which one choose ?
>
> Thanks :-)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org