You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Jacob Kjome <ho...@visi.com> on 2007/02/19 06:17:35 UTC

Re: ContextJNDISelector setup?

Moving discussion to the Log4j user list where it should be...

Here's some things to try...

1.  "classpath:log4j.xml" is not a valid classpath URL.  It's a 
pseudo-URL supported by Springframework, which is probably where you 
picked this usage up.  Log4j doesn't recognize this pseudo-URL 
syntax.  The value is expected to be either a fully qualified URL or 
a path for lookup by classloader.getResource().  So, just "log4j.xml" 
is fine, as long as it exists in the default package.  The thread 
context classloader will be used, so even if "log4j.xml" is in 
WEB-INF/classes of your webapp, while the log4j library is in 
common/lib, it will be found.

2.  It's "log4j.repositorySelector", not "log4j.repositorySelectorClass"


Make these changes and see if this fixes things.


Jake

At 10:18 PM 2/17/2007, you wrote:
 >Jacob -
 >
 >       i noticed you're the author of ContextJNDISelector from the log4j
 >1.3 API docs.  i've been having some trouble setting it up properly
 >and i was wondering if you could point me to some resources or send
 >me in the right direction here.
 >
 >       no matter what i try, i can't seem to get my logging to go to my
 >context-specific logfile -- it all goes to the logfile specified for
 >tomcat (obviously, i'm using log4j for tomcat logging).
 >
 >       i'm using:
 >
 >- logging-log4j-1.3alpha-8
 >- apache-tomcat-5.5.20
 >
 >       i have log4j in common/lib, log4j.properties in common/classes, and
 >all shared libs (spring, hibernate, et al) in shared/lib -- nothing
 >is in WEB-INF/lib.  tomcat properly logs w/o issues; so far, so good.
 >
 >       i've put:
 >
 >     <env-entry>
 >         <description>JNDI logging context name for this app</
 >description>
 >         <env-entry-name>log4j/context-name</env-entry-name>
 >         <env-entry-type>java.lang.String</env-entry-type>
 >         <env-entry-value>myContext</env-entry-value>
 >     </env-entry>
 >
 >     <env-entry>
 >         <description>URL for configuring log4j context</description>
 >         <env-entry-name>log4j/configuration-resource</env-entry-name>
 >         <env-entry-type>java.lang.String</env-entry-type>
 >         <env-entry-value>classpath:log4j.xml</env-entry-value>
 >     </env-entry>
 >
 >       into my webapp web.xml, log4j.xml into WEB-INF/classes, and i start
 >tomcat with ./startup.sh -
 >Dlog4j.repositorySelectorClass=org.apache.log4j.selector.ContextJNDISele
 >ctor, but no matter what i do all logging goes into the general
 >tomcat file...
 >
 >       i switched on debug logging and i can see all the env-entries
 >getting recognized and the proper path to log4j.xml entered, but
 >grepping for "ContextJNDISelector" or "selector" shows me nothing.
 >it seems like i'm missing something very basic here.
 >
 >       any ideas where i might be going wrong?  thanks a million in advance!
 >
 >
 >--
 >
 >- Stephen
 >
 >
 >
 >
 > 


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org