Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

log4j file load

 
Tmmet Johnson
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a web project and the web project has an ejb jar included in its build path.The ejb project automatically loads the log4j.properties which is located in ejbModule folder.
I have the below in web.xml.My question is , since, I have load-on startup set to 2, the log4j.properties that comes with struts.jar will be loaded first and then, the log4j.properties in ejb project will be loaded .Is that correct? Could anyone please let me know?
Thanks in advance,


<servlet>
<servlet-name>AppName</servlet-name>
<servlet-class>sorg.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The number in the load-on-startup stanza refers to the order in which servlets will be loaded. Since you only have one servlet, specifying 2 just means that the servlet will be loaded when the web application starts up. It has no significance in deciding whether it gets loaded before or after the EJB jar file.

Whether the war file or the EJB jar file will be loaded first is not specified in the J2EE spec, and can vary by app server. I use WebSphere, and in every instance I've monitored, it loads the EJB jar before the war file if they are part of the same EAR file. It may be different for your app server, though. You can tell by monotoring the System Out log as the server starts up. There will be a log entry for every entity as it starts up.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic