File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Spring and the fly likes Is logging compulsory with spring ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Is logging compulsory with spring ?" Watch "Is logging compulsory with spring ?" New topic
Author

Is logging compulsory with spring ?

Rajat Sharmanaive
Ranch Hand

Joined: Jun 30, 2011
Posts: 41

Hi

I was just doing a basic hands on of spring DI. I have a couple of beans in my xml and I try to instantiate the Spring container so that it loads the beans. Here is the code.


I removed all the lines because the first line itself causes an exception. I am sure on this. Everything is normal if I do not load container (that is, comment the first line )and just treat it as a normal core java program. Here is the exception.

I then add commons-logging jar to my project. There is no exception once I add it. My question is why is it so ? I have clearly checked all my code. Nowhere am i performing any logging. In fact, I do not even have any import statements related to logging. Why does Spring need this jar then. Does it need it internally or does any other jar I am using need logging features? I am pasting all the jars I am using. Most of them are not being used but I have kept them there because I keep trying different features back and forth. Is there some compulsion to use logging with Spring? I am deliberately not pasting xml or any more code for that matter because I am pretty sure the error is not related to anything else. I have thoroughly checked my code and there is no shred of logging. Still if anyone thinks I am wrong, please ask for more code. Thanks for help.

List of jars (I know its stupid enough but could there be a case that any of these jars need logging.)


Rajat Sharma
Rajat Sharmanaive
Ranch Hand

Joined: Jun 30, 2011
Posts: 41

Hi

Checked on net. Commons-logging is listed as a dependency for Spring. Not sure what that means exactly but it is clear I need it. I am trying to figure out what it means exactly. Any help on that is appreciated. Thanks.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17260
    
    6

Rajat Sharmanaive wrote:Hi

Checked on net. Commons-logging is listed as a dependency for Spring. Not sure what that means exactly but it is clear I need it. I am trying to figure out what it means exactly. Any help on that is appreciated. Thanks.


Basically, it means that inside Spring's own classes it uses Commons Logging classes, so it needs to be in the classpath at runtime.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Rajat Sharmanaive
Ranch Hand

Joined: Jun 30, 2011
Posts: 41

Thanks Mark.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is logging compulsory with spring ?