logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject Re: SV: ContextClassLoaderSelector
Date Fri, 11 Apr 2003 09:07:55 GMT

It is being used in a sample Barracuda project.  You can find the build here:
ftp://ftp.visi.com/users/hoju/pub

Note that there is one deficiency which I plan to fix.  The 
InitContextListener counts on Tomcat specific behavior of naming the temp 
directory for the application.  In Tomcat, it is very consitent and I can 
get the name of the context via...

String tempdir =
         "" + context.getAttribute("javax.servlet.context.tempdir");

That is used to automatically generate the system variable that is 
referenced in your log4j.xml file for the location of your log files if you 
are using a FileAppender.  The problem is, servers other than Tomcat name 
things somewhat randomly.  I plan to set up another context parameter 
which, if set, will override the automatic generation of the environment 
variable name.  I was hoping not to have to do this to avoid having to name 
it in multiple places, thereby forcing you to keep the variable name up to 
date in more than one place than the log4j.xml file.  Unfortunately, it is 
impossible when dealing with multiple servers with different behavior.

When you try out the build, if you want to run it under Tomcat, then first 
copy all jars in the web/WEB-INF/shared and shared_or_webapp directories to 
CATALINA_HOME/shared/lib with the exception of the log4j jar which should 
go to CATALINA_HOME/common/lib.

You can install/remove the app simply by doing...

ant catalina-install
and
ant catalina-remove

view the app by going to:
http://localhost:8080/pages-sample/

By default, you will see the output of logging in build/WEB-INF/logs/main.log


Jake

At 06:43 AM 4/11/2003 +0200, you wrote:
>Hi
>
>I found them and i'll have a look at them. Do you have any usage
>samples, or is it the same as the old one.
>
>Hermod
>
>-----Opprinnelig melding-----
>Fra: Jacob Kjome [mailto:hoju@visi.com]
>Sendt: 10. april 2003 17:09
>Til: Log4J Developers List
>Emne: Re: ContextClassLoaderSelector
>
>
>
>Please note that you are using an old version of the
>ContextClassLoaderSelector.  The current version no longer contains
>doIdempotentInitialization()..  Actually, it is much more
>simplified.  Also, look at ContextJNDISelector and then use
>InitContextListener for configuration in a servlet container....or take
>the
>ideas from that and write your own initializer.
>
>Get the latest by following instruction here:
>http://jakarta.apache.org/site/cvsindex.html
>
>and use the module "jakarta-log4j-sandbox" even though it isn't listed
>as
>an existing module on that page.  Actually, why isn't it listed?  It
>should
>be, shouldn't it?
>
>
>Jake
>
>
>
>At 10:56 AM 4/10/2003 +0200, you wrote:
> >Hi
> >
> >I have a question regarding the ContextClassLoaderSelector.
> >
> >When you call the doIdempotentInitialization() method it dows a call :
> >LogManager.setRepositorySelector(singleton, guard)
> >
> >In the LogManager there is a static initalizer that initializes log4j
> >from any log4j configuration file that is in the classpath.
> >
> >It looks to me as if it finds the log4j configuration file that is also
> >used in a subsequent call to
> >PropertyConfigurator.configureAndWatch(log4j configfile, delay),
> >somehing goes wrong
> >
> >Below is listed the code in question from the
> >ContextClassLoaderSelectorInitalizer
> >
> >
> >         ContextClassLoaderSelector.doIdempotentInitialization();
> >
> >         PropertyConfigurator.configureAndWatch(cPath +
> >System.getProperty("file.separator") + "log4j.properties",
> >refreshInterval);
> >
> >
> >Hermod
> >
> >
> >* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
>* *
> >
> >This email with attachments is solely for the use of the individual or
> >entity to whom it is addressed. Please also be aware that DnB cannot
> >accept any payment orders or other legally binding correspondence with
> >customers as a part of an email.
> >
> >This email message has been virus checked by the virus programs used
> >in the DnB Group.
> >
> >* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
>* *
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: log4j-dev-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: log4j-dev-help@jakarta.apache.org
>
>
>* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
>
>This email with attachments is solely for the use of the individual or
>entity to whom it is addressed. Please also be aware that DnB cannot
>accept any payment orders or other legally binding correspondence with
>customers as a part of an email.
>
>This email message has been virus checked by the virus programs used
>in the DnB Group.
>
>* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-dev-help@jakarta.apache.org

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message