This week's giveaways are in the MongoDB and Jobs Discussion forums.
We're giving away four copies of Mongo DB Applied Patterns and 4 resume reviews from Five Year Itch and have the authors/reps on-line!
See this thread and this one for details.
The moose likes EJB and other Java EE Technologies and the fly likes EJB + log4j Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply Bookmark "EJB + log4j" Watch "EJB + log4j" New topic
Author

EJB + log4j

vidya sagar
Ranch Hand

Joined: Mar 02, 2005
Posts: 580
In my EJB application i want to configure log4j.

1)--> Where i want to place the log4j-config.xml in my jar file.

2)--> How to read the log4j-config.xml in my intializer class.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 8141
    
  52

Log4j tries to configure itself by searching in its classpath for log4j.properties or log4j.xml file. If you place the log4j.xml file in the classpath of the application then you need not write any code to read the file. You can start using the logger as follows in your code:



However if you still want to read/configure the log4j config file yourself in the application then have a look at the configure() method available on DOMConfigurator


[My Blog] [JavaRanch Journal]
vidya sagar
Ranch Hand

Joined: Mar 02, 2005
Posts: 580
Thanks Jaikiran Pai, just now sucuessfully configured.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: EJB + log4j
 
Similar Threads
Log4J parses the props file, but does not affect anything
Log4j Configurattion in config file
JNLP log4J Classnotfound Exception
Date in filename of log4j
Struts - EJB - model