Hi guys,

I know it's not a real Tomcat-topic, however, it's close to and I'm
wondering if anyone on this list might come up with some kind of a
smart solution.

Most of you may know the typical first lines of any log4j.xml-config-file:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

So far, so bad.

Why bad?

Because every bloody servlet needs it's very own log4j.dtd together
with it's log4j.xml, which is why I'm looking for a smarter solution.

It's a good thing that every servlet has it's onown log4j.xml so that
each servlet can be configured - here I would like the idea of a
cantral log4j-configuration-file.

However, with log4j.dtd things are slightly different since it's
always a file with the same content and I really dislike redundancies.

So my idea was to use ${CATALINA_HOME}, pass this via "-Dlog4j.dtd as
a Java-property to Tomcat and evaluate this property within log4j.xml,
however, that does not seem to work:

======== [ from catalina.sh ] =================
CATALINA_OPTS="  -Xmx256m -server \
         -Djava.awt.headless=true \
         -Dlog4j.dtd=${CATALINA_HOME}/common/classes/log4j.dtd \
         -Dlog4j.configuration=log4j.xml"
========================================


======== [ from some log4j.xml ] ===============
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "${log4j.dtd}">
========================================

The result:

log4j:ERROR Could not parse url
[file:/home/tomcat/www/common/classes/log4j.xml].
java.net.MalformedURLException: no protocol: ${log4j.dtd}
    at java.net.URL.<init>(URL.java:567)
    at java.net.URL.<init>(URL.java:464)
    [ ...some more stuff deleted ]

I do no that I can pass a URL, so basically some thing like

<!DOCTYPE log4j:configuration SYSTEM "http://localhost/mylog4jconf/log4j.dtd";>

should work, but I don't like the idea that I have some directory just
containg some configuration-files which is accessible via http.

I know, I could use a RemoteAdressFilter which just allows connection
from localhost for this webapp, but all this looks a bit too
complicated /awkward to me.

besides, on this box is not only one but a whole bunch of virtual
hosts with obviously different domains running.

Ah well, before André's complaining: ;)

My config is as follows:

Using CATALINA_BASE:   /home/tomcat/www
Using CATALINA_HOME:   /home/tomcat/www
Using CATALINA_TMPDIR: /home/tomcat/www/temp
Using JRE_HOME:       /opt/jdk1.5
Server version: Apache Tomcat/5.5.17
Server built:   Apr 14 2006 02:08:29
Server number:  5.5.17.0
OS Name:        Linux
OS Version:     2.6.18-5-686
Architecture:   i386
JVM Version:    1.5.0_07-b03
JVM Vendor:     Sun Microsystems Inc.

However, same goes for Tomcat 6 with Java 6 and [put your preferred
environment here ]

So guys, anyone smart around here?

Cheers

Gregor
-- 
just because your paranoid, doesn't mean they're not after you...
gpgp-fp: 79A84FA526807026795E4209D3B3FE028B3170B2
gpgp-key available
@ http://pgpkeys.pca.dfn.de:11371
@ http://pgp.mit.edu:11371/
skype:rc46fi

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to