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 setting up log4j in an applicationcontext Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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: 29231
    
135

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: 17249
    
    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: 29231
    
135

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

Joined: Feb 05, 2001
Posts: 17249
    
    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
 
Similar Threads
Spring Remoteness
HELP accessing Class Path Xml ApplicationContext in aar file
Accessing spring beans across different application context files
Load the beanrefContext.xml in web Application
How can I share a static field between 2 class loaders?