You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by David of Sweden <da...@mindwell.se> on 2008/08/07 09:44:07 UTC

log4j: how to get a Logger

Hi,

The log4j.xml lets one configure a number of loggers, but can someone tell
me the preferred way of how to actually retrieve a Logger object, configured
by that file, in my own servicemix components to use for logging? Is there
any shared LoggerFactory etc. that one should use?

thanks //David
-- 
View this message in context: http://www.nabble.com/log4j%3A-how-to-get-a-Logger-tp18865662p18865662.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Maven Dependencies on SMX 3.2.2

Posted by Markus Wolf <ma...@nmmn.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

we have a problem building our SU and SA projects with the current 3.2.2
release using maven. There are some dependencies missing since some
days. I'll guess there was a cleanup on apache-snapshots and now some
files are missing.
Is there any way to resolve this?

Here are our build failures:

Missing:
- ----------
1) org.apache.xbean:xbean-classloader:jar:3.3-SNAPSHOT

~  Try downloading the file manually from the project website.

~  Then, install it using the command:
~      mvn install:install-file -DgroupId=org.apache.xbean
- -DartifactId=xbean-classloader -Dversion=3.3-SNAPSHOT -Dpackaging=jar
- -Dfile=/path/to/file

~  Alternatively, if you host your own repository you can deploy the file
there:
~      mvn deploy:deploy-file -DgroupId=org.apache.xbean
- -DartifactId=xbean-classloader -Dversion=3.3-SNAPSHOT -Dpackaging=jar
- -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

~  Path to dependency:
~  	1) org.apache.servicemix.tooling:jbi-maven-plugin:maven-plugin:3.2.2
~  	2) org.apache.servicemix:servicemix-core:jar:3.2.2
~  	3) org.apache.xbean:xbean-server:jar:3.3
~  	4) org.apache.xbean:xbean-classloader:jar:3.3-SNAPSHOT

2) org.apache.xbean:xbean-kernel:jar:3.3-SNAPSHOT

~  Try downloading the file manually from the project website.

~  Then, install it using the command:
~      mvn install:install-file -DgroupId=org.apache.xbean
- -DartifactId=xbean-kernel -Dversion=3.3-SNAPSHOT -Dpackaging=jar
- -Dfile=/path/to/file

~  Alternatively, if you host your own repository you can deploy the file
there:
~      mvn deploy:deploy-file -DgroupId=org.apache.xbean
- -DartifactId=xbean-kernel -Dversion=3.3-SNAPSHOT -Dpackaging=jar
- -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

~  Path to dependency:
~  	1) org.apache.servicemix.tooling:jbi-maven-plugin:maven-plugin:3.2.2
~  	2) org.apache.servicemix:servicemix-core:jar:3.2.2
~  	3) org.apache.xbean:xbean-server:jar:3.3
~  	4) org.apache.xbean:xbean-kernel:jar:3.3-SNAPSHOT


Thanks
Markus
- --
NMMN - New Media Markets & Networks GmbH
Geschäftsführung: Kfm. Michael Schütt
Finanzamt HH-Altona UStID DE 812 699 852  HRB 71102 Hamburg
HypoVereinsbank  -   BLZ 200 300 00  -  Konto-Nr. 156 29 82

http://www.nmmn.com               Tel.: +49 40 284 118 -0
Langbehnstrasse 6                 Entwicklung:         -720
22761 Hamburg                     Fax:                 -999

Rufen Sie uns kostenlos an: http://www.nmmn.com/call/software
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIoVWdDBHISU1oEKERAngXAKCF/aStJLl1lws61PpbiQIs+GeHPwCfYo1/
WFTy0bm3qlELiiqs02RMYHk=
=HxRg
-----END PGP SIGNATURE-----

Re: log4j: how to get a Logger

Posted by Bruce Snyder <br...@gmail.com>.
On Wed, Aug 13, 2008 at 2:14 AM, David of Sweden
<da...@mindwell.se> wrote:
>
> Thanks, now I get it. The motivation for the wrapper I assume has to do with
> things like the Log class listening to changes in the log4j.xml at runtime,
> and such.

The Jakarta Commons Logging (JCL) wrapper is only there to mask the
actual implementation and according to the guy who created JCL is a
misuse of JCL. I have a writeup about Java logging available here if
you're interested:

http://bsnyderblog.blogspot.com/2007/08/my-soapbox-for-slf4j.html

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.org/
Apache Camel - http://activemq.org/camel/
Apache ServiceMix - http://servicemix.org/

Blog: http://bruceblog.org/

Re: log4j: how to get a Logger

Posted by Thomas Termin <tt...@blue-elephant-systems.com>.
David of Sweden wrote:
> changes in the log4j.xml at runtime,
This is an implementation detail of servicemix and has nothing to do
with log4j or JCL

Cheers,
-- 
Thomas Termin
_______________________________
blue elephant systems GmbH
Wollgrasweg 49
D-70599 Stuttgart

Tel    :  (+49) 0711 - 45 10 17 676
Fax    :  (+49) 0711 - 45 10 17 573
WWW    :  http://www.blue-elephant-systems.com
Email  :  Thomas.Termin@blue-elephant-systems.com

blue elephant systems GmbH
Firmensitz      : Wollgrasweg 49, D-70599 Stuttgart
Registergericht : Amtsgericht Stuttgart, HRB 24106
Geschäftsführer : Holger Dietrich, Thomas Gentsch, Joachim Hoernle


Re: log4j: how to get a Logger

Posted by David of Sweden <da...@mindwell.se>.
Thanks, now I get it. The motivation for the wrapper I assume has to do with
things like the Log class listening to changes in the log4j.xml at runtime,
and such.

//D
-- 
View this message in context: http://www.nabble.com/log4j%3A-how-to-get-a-Logger-tp18865662p18958754.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: log4j: how to get a Logger

Posted by Thomas Termin <tt...@blue-elephant-systems.com>.
David of Sweden wrote:
> 
> Gert Vanthienen wrote:
> 
>>David,
>>
>>If you are building your own components, you can extends 
>>DefaultComponent which has a logger preconfigured.  Most people aren't 
>>building their own JBI component though, they are using our components 
>>and e.g. adding POJOs to the servicemix-bean component.  For those too, 
>>we have convenience base classes (like 
>>org.apache.servicemix.bean.support.BeanSupport) which have the logger 
>>preconfigured.
>>
> 
> 
> 
> hi and thankt,
> 
> yes, I am building my own BC. At any rate I really need more control than to
> just use the logger of the component. I want different loggers for different
> purposes. I just want to create a logger for a specific class from scratch.
> Further I'm confused about that the "logger" member variable of the
> component is of a class org.apache.commons.logging.Log, not the log4j class
> org.apache.log4j.Logger. What's the difference between these?
log4j is the implementation and commons logging a wrapper. So by default
 log4j is the logger behind the commons logging in servicemix.

Log logger = LogFactory.getLog(YourClass.class);

is one way to obtain the logger.

If you want your logger to log in another file or whatever you should
prepare the conf/log4j.xml which is possible at runtime.

> Right now I'm trying out things like 
> LogManager.getLogger(this.getClass());
> But I don't quite get it to do what I want.
What is it?
> 
> //David


Cheers,
-- 
Thomas Termin
_______________________________
blue elephant systems GmbH
Wollgrasweg 49
D-70599 Stuttgart

Tel    :  (+49) 0711 - 45 10 17 676
Fax    :  (+49) 0711 - 45 10 17 573
WWW    :  http://www.blue-elephant-systems.com
Email  :  Thomas.Termin@blue-elephant-systems.com

blue elephant systems GmbH
Firmensitz      : Wollgrasweg 49, D-70599 Stuttgart
Registergericht : Amtsgericht Stuttgart, HRB 24106
Geschäftsführer : Holger Dietrich, Thomas Gentsch, Joachim Hoernle


Re: log4j: how to get a Logger

Posted by David of Sweden <da...@mindwell.se>.

Gert Vanthienen wrote:
> 
> David,
> 
> If you are building your own components, you can extends 
> DefaultComponent which has a logger preconfigured.  Most people aren't 
> building their own JBI component though, they are using our components 
> and e.g. adding POJOs to the servicemix-bean component.  For those too, 
> we have convenience base classes (like 
> org.apache.servicemix.bean.support.BeanSupport) which have the logger 
> preconfigured.
> 


hi and thankt,

yes, I am building my own BC. At any rate I really need more control than to
just use the logger of the component. I want different loggers for different
purposes. I just want to create a logger for a specific class from scratch.
Further I'm confused about that the "logger" member variable of the
component is of a class org.apache.commons.logging.Log, not the log4j class
org.apache.log4j.Logger. What's the difference between these?

Right now I'm trying out things like 
LogManager.getLogger(this.getClass());
But I don't quite get it to do what I want.

//David
-- 
View this message in context: http://www.nabble.com/log4j%3A-how-to-get-a-Logger-tp18865662p18939579.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: log4j: how to get a Logger

Posted by Gert Vanthienen <ge...@skynet.be>.
David,

If you are building your own components, you can extends 
DefaultComponent which has a logger preconfigured.  Most people aren't 
building their own JBI component though, they are using our components 
and e.g. adding POJOs to the servicemix-bean component.  For those too, 
we have convenience base classes (like 
org.apache.servicemix.bean.support.BeanSupport) which have the logger 
preconfigured.

Regards,

Gert

David of Sweden wrote:
> Hi,
>
> The log4j.xml lets one configure a number of loggers, but can someone tell
> me the preferred way of how to actually retrieve a Logger object, configured
> by that file, in my own servicemix components to use for logging? Is there
> any shared LoggerFactory etc. that one should use?
>
> thanks //David
>