I am working on this question. Here is partial answer from the new log4j manual:

4.3. Initilization of log4j in Enterprise Java Beans

4.3.1. JBoss

As of version 2.4, JBoss uses log4j for its own logging. Consequently,
your own EJBs and web applications will automatically inherit jBoss'
log4j configuration.

More often than not you to keep your application's logs separate from
the Application Server log. JBoss adopting log4j is a step backward in
some sense. There are a number of possible solutions.

The easiest solution is to modify jboss' log4j configuration
file. Assuming all your classes live under com.wombat package or
packages under it, configuring a a category called com.wombat and
setting it's level and additivity will isolate all categories under it
effectively isolating logging from your code from that of JBoss. For
this approach to work properly your code should not make use of the
categories that JBoss uses such as those under org.jboss nor the root
category.


--------------------------------------------------------------------------------

4.3.2. Weblogic 6.x

One simple but somewhat inflexible approach for using log4j under
weblogic is to add log4j.jar to the system classpath before launching
Weblogic server. This is guaranteed to work except that all
applications will be sharing the same instance of the log4j classes
and consequently share the same log4j configuration.

However, it is also possible to have Weblogic load a separate instance
of log4j classes per appliction. Altough not difficult this approach
requires some rudimentary understanding of the way Weblogic loads your
applications.

Contrary to version 5.x, when WebLogic Server 6.x deploys an
application, it creates two new classloaders: one for EJBs and one for
Web applications. The first, the so called "EJB classloader" is a
child of the system classloader. The second, the so called
"Web-application" classloader is a child of the EJB classloader. Thus,
classes in the web-application can access the classes in your
enterprise beans but not vice versa. See Weblogic Classloader Overview
for more details.

As far as I know, contrary to Servlet Containers which are required to
load classes and jar files located under the /WEB-INF/classes and
/WEB-INF/lib directory, there is no standard location that the EJB
container will search in order to load your utility classes. As
mentioned earlier, one solution to circumvent this problem is to add
log4j to the Java system classpath with the aforementioned
limitations. Another approach is to include log4j.jar within your EJB
jar files. This has the distinct disadvantage of bloat.

There is a better and quite elegant solution. Version 1.2 of the Java
platform, added support for bundled extensions for jar files. An
application (or, more generally, JAR file) specifies the relative URLs
of the extensions (and libraries) that it needs via the manifest
attribute Class-Path.



At 19:32 11.10.2001 -0700, you wrote:
>Hello All,
> 
> 
>I'm using JBoss 2.4 and as I found that it use Log4J as the logging mechanism and 
>there is a log4j.properties file 
>I am also using Log4J API for logging and have separte properties file, but problem 
>is that after calling PropertyConfigurator.configure method all the log message of 
>Jboss also comes in to the my application's log file, now my question is 
> 
>        Is it possible to have separate properties file ? The reason i am using 
>separate file is that other wise my application user have to play with property file 
>which contains JBoss logging properties also and in my application i am also having 
>root category.
> 
>
>Any thought??
> 
> 
>Regards
>Naresh

--
Ceki Gülcü - http://qos.ch
Link of the day: http://www.skeptictank.org/isaac.htm


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to