hoju 2003/02/26 22:27:43 Modified: src/java/org/apache/log4j/selector ContextJNDISelector.java src/java/org/apache/log4j/servlet InitContextListener.java InitServlet.java Log: Minor updates to documentation and some debugging comments about minor JNDI lookup issue under Tomcat5. Jake Revision Changes Path 1.2 +20 -9 jakarta-log4j-sandbox/src/java/org/apache/log4j/selector/ContextJNDISelector.java Index: ContextJNDISelector.java =================================================================== RCS file: /home/cvs/jakarta-log4j-sandbox/src/java/org/apache/log4j/selector/ContextJNDISelector.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ContextJNDISelector.java 26 Feb 2003 23:22:55 -0000 1.1 +++ ContextJNDISelector.java 27 Feb 2003 06:27:43 -0000 1.2 @@ -103,10 +103,10 @@ * <blockquote> * <pre> * <env-entry> - * <description>The Tiger webapp logging context</description> + * <description>JNDI logging context for this app</description> * <env-entry-name>log4j/logging-context</env-entry-name> + * <env-entry-value>uniqueLoggingContextValue</env-entry-value> * <env-entry-type>java.lang.String</env-entry-type> - * <env-entry-value>TigerLoggingContext</env-entry-value> * </env-entry> * </pre> * </blockquote> @@ -115,13 +115,17 @@ * <p>Unlike the [EMAIL PROTECTED] ContextClassLoaderSelector} which will only work in * containers that provide for separate classloaders, JNDI is available in all * servers claiming to be servlet or J2EE compliant. So, the JNDI selector - * may be the better choice. However it is possible, at least in non-servlet - * parts of J2EE apps, to spoof the value of the env-entry. There are ways - * to avoid this, but this class makes no attempt to do so. It would require - * a container specific implementation to, maybe, append a non-random unique - * name to the user-defined value of the env-entry. Keep that in mind as you - * choose which custom repository selector you would like to use in your own - * application.</p> + * may be the better choice. However it is possible to spoof the value of the + * env-entry. There are ways to avoid this, but this class makes no attempt + * to do so. It would require a container specific implementation to, + * for instance, append a non-random unique name to the user-defined value of + * the env-entry. Keep that in mind as you choose which custom repository + * selector you would like to use in your own application. Until this issue + * is solved by container-controlled repository selectors, you will need to + * be diligent in providing a distinctive env-entry-value for each application + * running on the server. This is not an issue when using the + * [EMAIL PROTECTED] ContextClassLoaderSelector} in containers in which it is compatible + * (such as Tomcat 4/5)</p> * * @author Jacob Kjome * @since 1.3 @@ -162,6 +166,13 @@ (String) ctx.lookup("java:comp/env/log4j/logging-context"); } catch (NamingException ne) { // we can't log here + //debug minor issue in Tomcat5 where, after the first webapp install, + //the second webapp first fails the JNDI lookup and Log4j reports that + //"no appenders could be found". Subsequent webapp installs report the + //same except with no "no appenders could be found" message. However, + //the appender do indeed work so I'm not sure why it is reported that + //they don't? No issues like this in Tomcat4. + //System.out.println("failed to look up logging context!"); } if (loggingContextName == null) { 1.4 +2 -2 jakarta-log4j-sandbox/src/java/org/apache/log4j/servlet/InitContextListener.java Index: InitContextListener.java =================================================================== RCS file: /home/cvs/jakarta-log4j-sandbox/src/java/org/apache/log4j/servlet/InitContextListener.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- InitContextListener.java 26 Feb 2003 23:22:55 -0000 1.3 +++ InitContextListener.java 27 Feb 2003 06:27:43 -0000 1.4 @@ -525,8 +525,8 @@ + "selector..."); } catch (IllegalArgumentException iae) { LogLog.warn( - "Unable to install preferred selector because another selector has " - + "already been installed. Using existing selector..."); + "Preferred repository selector not installed because one has already " + + "exists. No problem, using existing selector..."); } } } 1.4 +2 -2 jakarta-log4j-sandbox/src/java/org/apache/log4j/servlet/InitServlet.java Index: InitServlet.java =================================================================== RCS file: /home/cvs/jakarta-log4j-sandbox/src/java/org/apache/log4j/servlet/InitServlet.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- InitServlet.java 26 Feb 2003 23:22:56 -0000 1.3 +++ InitServlet.java 27 Feb 2003 06:27:43 -0000 1.4 @@ -433,8 +433,8 @@ + "selector..."); } catch (IllegalArgumentException iae) { LogLog.warn( - "Unable to install preferred selector because another selector has " - + "already been installed. Using existing selector..."); + "Preferred repository selector not installed because one has already " + + "exists. No problem, using existing selector..."); } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]