Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Spring and the fly likes setting up log4j in an applicationcontext Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "setting up log4j in an applicationcontext" Watch "setting up log4j in an applicationcontext" New topic
Author

setting up log4j in an applicationcontext

Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30537
    
150

I have some Spring code that I'm calling via instantiating a new ApplicationContext (because it is being called from an EJB in an app without a front end.) I'm trying to figure out how to tell it about the location of log4j. Normally we store our debugging property file in /config/log4j... or the like. The root of that is in the classpath, but the log4j file itself is not. Is there a way I can tell Spring/Hibernate where to find the log4j file directly? In a web app, I'd use a listener, but no web app here.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Just put the log file into the root of your classpath. If you put it into a config directory. Add that directory to your classpath.

http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/overview.html#d0e826

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30537
    
150

Ok. Ok. Do the obvious and put it where Spring says it should go.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Jeanne Boyarsky wrote:Ok. Ok. Do the obvious and put it where Spring says it should go.


Well, not necessarily. You can put it anywhere, just set that anywhere to be part of the classpath.

Mark
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: setting up log4j in an applicationcontext