Has anyone investigated the truthfulness of the following earlier post (by Jacob) on the subject:

<snip>
I just wanted to report something I read about the JBoss class loading scheme. You can view this information at...
<http://umn.dl.sourceforge.net/sourceforge/jboss/ClassLoading.pdf>http://umn.dl.sourceforge.net/sourceforge/jboss/ClassLoading.pdf


<quote>
WAR Loader. The WAR Loader is a servlet container specific ClassLoader that delegates to the Web
ENCLoader as its parent class loader. The default behavior is to load from its parent class loader and
then the war WEB-INF/{classes,lib} directories. If the servlet 2.3 class loading model is enabled it
will first load from the war WEB-INF/{classes,lib} and then the parent class loader.
<quote>


<snip>

This would seem to be intimately related.


At 12:40 AM 10/17/2003, Jacob Kjome wrote:


Try reading this and see if it helps out:
http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/AppContainerLogging

I'm not sure exactly the problem under JBoss, but they do seem to have the concept of a single classloader, which seems to cause grief for people who want to deploy their preferred versions of various libraries in WEB-INF/lib only to be overridden by the same library in JBoss itself. Is there someone out there that can explain why JBoss' behavior is a good thing????

Jake

At 03:42 PM 10/16/2003 -0400, you wrote:
I neglected to say that, if I move my logger and appender definitions into
JBoss's log4j.xml, I DO get the expected files. My question is: how can I
ADD new loggers and appenders from a separate config file to the hierarchy
that JBoss has already established?


-----Original Message----- From: Doubleday, Dennis [mailto:[EMAIL PROTECTED] Sent: Thursday, October 16, 2003 3:11 PM To: '[EMAIL PROTECTED]' Subject: App-server independent log4j logging


My application needs to be deployable to both JBoss and Websphere (and possibly Weblogic in future). I am trying to use log4j in my app, but not having any success, even only with JBoss.

Here's the deal--I want to include my own log4j.jar and log4j.xml in my WAR
file. If the app server is using log4j itself, as JBoss does, my log4j.xml
should only extend the configuration set up by JBoss. I don't want to add my
Appenders to the JBoss log4j.xml, I want them in my WAR so it doesn't depend
on the JBoss environment.

Here is a snippet of what I am doing in my init servlet:

        String prefix =  getServletContext().getRealPath("/");
        String filePath = prefix + fileName;

        System.out.println
           ("Log4JConfigServlet - initializing log4j using file: " +
filePath);

        try {
            if (fileName.indexOf("xml") != -1) {
                DOMConfigurator.configure(filePath);
            } else {
                PropertyConfigurator.configure(filePath);
            }

           Logger log = Logger.getLogger(Log4JConfigServlet.class);
           if (log.isInfoEnabled()) {
               log.info("Log4j initilized.");
           }

} catch (Exception e) {

I see both the println and the initial INFO log message in the JBoss console
log, but the two FILE appenders don't seem to be getting created--I see
debug output from the initial JBoss configuration but there is no debug
output when my config file is processed. (The full file is at the end of the
message).

This approach worked in JBoss 3.0.6 but it mysteriously stopped when I
upgraded to JBoss 3.2.1.

Here's my log4j.xml:

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/";
debug="true">

  <!-- ================================= -->
  <!-- Preserve messages in a local file -->
  <!-- ================================= -->

  <!-- A size based file rolling appender -->
  <appender name="FALCONFILE" class="org.apache.log4j.RollingFileAppender">
    <param name="File" value="Falcon.log"/>
    <param name="Append" value="false"/>
    <param name="MaxFileSize" value="500KB"/>
    <param name="MaxBackupIndex" value="20"/>

    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d %-5p [%c{1}.%M] %m%n"/>
    </layout>
  </appender>

  <appender name="FALCONHTML" class="org.apache.log4j.RollingFileAppender">
    <param name="File" value="Falcon.html"/>
    <param name="Append" value="false"/>
    <param name="MaxFileSize" value="500KB"/>
    <param name="MaxBackupIndex" value="20"/>
    <param name="threshold" value="info"/>

<layout class="org.apache.log4j.HTMLLayout"/>

</appender>

  <appender name="FALCONCONSOLE" class="org.apache.log4j.ConsoleAppender">
    <param name="Target" value="System.out"/>

    <layout class="org.apache.log4j.PatternLayout">
      <!-- The default pattern: Date Priority [Category] Message\n -->
      <param name="ConversionPattern" value="%-5p [%c{1}] %m%n"/>
    </layout>
  </appender>

  <!-- Falcon base logger -->
  <logger name="com.vocollect">
    <level value="debug" />
    <appender-ref ref="FALCONFILE" />
    <appender-ref ref="FALCONHTML" />
  </logger>

</log4j:configuration>

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

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


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


_________________________________________________ Donald Larmee ALTERthought, Inc. [EMAIL PROTECTED] 804.301.8867 (c) 877.825.9607 (office) _________________________________________________


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



Reply via email to