At 05:39 PM 11/6/2003 +0100, you wrote:

>You never answered my question about how your repository selector
>distinguishes between logger repositories.

What do you mean by this?  Should I do something special in your solution
ContextClassLoaderSelector that you put in the sandbox?

There is both a ContextClassLoaderSelector and a ContextJNDISelector. Which one do you use? Actually, from what you had written, it seemed to me that you wrote your own based on what I wrote and didn't use exactly what I wrote, so I was wondering what you did.


Oh, you know what, I bet you are using a very old version of all this stuff. I recommend an upgrade. Check out the latest log4j-sandbox stuff. You can control which selector you use by doing this....

    <context-param>
        <!-- preferred repository selector. "preferred" because if one
             is already installed, this choice is ignored. -->
        <param-name>log4j-selector</param-name>
        <param-value>org.apache.log4j.selector.ContextJNDISelector</param-value>
    </context-param>
    <context-param>
        <!-- relative path to config file within current webapp -->
        <param-name>log4j-config</param-name>
        <param-value>WEB-INF/log4j.xml</param-value>
    </context-param>
    <context-param>
        <param-name>log4j-cron</param-name>
        <param-value>0</param-value>
    </context-param>

    <listener>
        <listener-class>
        org.apache.log4j.servlet.InitContextListener
        </listener-class>
    </listener>
...
...
...
    <env-entry>
        <description>JNDI logging context for this webapp</description>
        <env-entry-name>log4j/logging-context</env-entry-name>
        <env-entry-value>SomeStringUniqueForThisContext</env-entry-value>
        <env-entry-type>java.lang.String</env-entry-type>
    </env-entry>


Using the JNDI selector might make things less susceptible to hard-to-debug classloader issues.


>Also, you don't have log4j.jar
>in WEB-INF/lib of any of your webapps, do you?  That would cause Log4j not
>to see the shared classes in the parent classloader.  In your case, I
>recommend removing any log4j.jar files and any jars containing the
>repository selectors from WEB-INF/lib of any and all webapps and putting
>log4j.jar and the jar containing your selectors in
CATALINA_HOME/common/lib.

Done.

>As far as general server logging, you can put a log4j.xml in
>CATALINA_HOME/common/classes and let the server use the default logger
>repository.

That is exactly what I do.

>  Each webapp can use its own config file, but you'll have to
>set the repository selector and configure the repository from your
>webapps.  You can use my log4j servlet context listener to do
>this.

Based on below, I would move your log4j.xml into WEB-INF, and move it out of WEB-INF/classes. That will get rid of any confusion with automatic configuration.


Beyond what I've told you, I'm really not sure why your server config stops being output. It makes me think that, somehow, the separate repository isn't being used when the webapps configure themselves. You'll have to test some things out. Not sure I can help much more here.

Jake




I'm using your servlet context listener with this in my web.xml:

---------------------------------------------------
!--==========================================================
      - Log4j config parameters
      ==========================================================-->
    <context-param>
        <param-name>log4j-selector</param-name>

<param-value>org.apache.log4j.selector.ContextClassLoaderSelector</param-val
ue>
    </context-param>
    <context-param>
        <param-name>log4j-config</param-name>
        <param-value>WEB-INF/classes/log4j.xml</param-value>
    </context-param>
    <context-param>
        <param-name>log4j-cron</param-name>
        <param-value>0</param-value>
    </context-param>

<listener>

<listener-class>org.apache.log4j.servlet.InitContextListener</listener-class
>
    </listener>
---------------------------------------------------

>Otherwise, you can set something up in the container to set the
>repository selector before any webapps get deployed.

For this solution, I have to investigate more on how to achieve this with
Resin.

>Try all that and let me know how things work.

>Jake

here's my resin console output
----------------------------------------------------
log4j: Threshold ="null".
log4j: Level value for root is  [DEBUG].
log4j: root level set to DEBUG
log4j: Class name: [org.apache.log4j.ConsoleAppender]
log4j: Parsing layout of class: "org.apache.log4j.PatternLayout"
log4j: Setting property [conversionPattern] to [%t %d{hh:mm:ss} %c %M %p
line %L
 -%m%n].
log4j: Adding appender named [CONSOLE] to category [root].
log4j: Retreiving an instance of org.apache.log4j.Logger.
log4j: Setting [com.codestudio.util.PoolSkimmerThread] additivity to
[false].
log4j: Level value for com.codestudio.util.PoolSkimmerThread is  [INFO].
log4j: com.codestudio.util.PoolSkimmerThread level set to INFO
log4j: Adding appender named [CONSOLE] to category
[com.codestudio.util.PoolSkim
merThread].
log4j: Retreiving an instance of org.apache.log4j.Logger.
log4j: Setting [com.azrdm.util.DbControler] additivity to [false].
log4j: Level value for com.azrdm.util.DbControler is  [DEBUG].
log4j: com.azrdm.util.DbControler level set to DEBUG
log4j: Adding appender named [CONSOLE] to category
[com.azrdm.util.DbControler].

log4j: System property is :com.caucho.xml.parsers.XmlDocumentBuilderFactory
log4j: Standard DocumentBuilderFactory search succeded.
log4j: DocumentBuilderFactory is:
com.caucho.xml.parsers.XmlDocumentBuilderFacto
ry
log4j: debug attribute= "true".
log4j: Threshold ="null".
log4j: Retreiving an instance of org.apache.log4j.Logger.
log4j: Setting [org.apache.commons.validator.ValidatorResources] additivity
to [
false].
log4j: Level value for org.apache.commons.validator.ValidatorResources is
[WARN
].
log4j: org.apache.commons.validator.ValidatorResources level set to WARN
log4j: Class name: [org.apache.log4j.ConsoleAppender]
log4j: Parsing layout of class: "org.apache.log4j.PatternLayout"
log4j: Setting property [conversionPattern] to [%t %d{hh:mm:ss} %c %M %p
line %L
 -%m%n].
log4j: Adding appender named [X] to category
[org.apache.commons.validator.Valid
atorResources].
log4j: Retreiving an instance of org.apache.log4j.Logger.
log4j: Setting [org.apache.struts.validator.ValidatorPlugIn] additivity to
[fals
e].
log4j: Level value for org.apache.struts.validator.ValidatorPlugIn is
[WARN].
log4j: org.apache.struts.validator.ValidatorPlugIn level set to WARN
log4j: Adding appender named [X] to category
[org.apache.struts.validator.Valida
torPlugIn].
log4j: Retreiving an instance of org.apache.log4j.Logger.
log4j: Setting [org.apache.struts.util.PropertyMessageResources] additivity
to [
false].
log4j: Level value for org.apache.struts.util.PropertyMessageResources is
[WARN
].
log4j: org.apache.struts.util.PropertyMessageResources level set to WARN
log4j: Adding appender named [X] to category
[org.apache.struts.util.PropertyMes
sageResources].
log4j:WARN No appenders could be found for logger (DbController.class).
log4j:WARN Please initialize the log4j system properly.
log4j: Finalizing appender named [CONSOLE].

--------
steph

---------------------------------------------------------------------
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]



Reply via email to