Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

log4j in shared hosting environment

Status
Not open for further replies.

cjhowland

Programmer
Apr 25, 2002
12
0
0
GB
I am trying to use log4j to provide logging in a shared Tomcat hosting environment. I am running Tomcat4.1.29 on a Red Hat Linux/Apache server with the EnsimPro web appliance control panel.

I have uploaded the log4j jar file to /vat/tomcat4/common/lib and placed a log4j.xml file in /var/tomcat4/common/classes and this works to generate a log file for the server.

My log4j.xml looks like this :

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

<log4j:configuration xmlns:log4j=&quot;
<appender name=&quot;appender&quot; class=&quot;org.apache.log4j.RollingFileAppender&quot;>
<param name=&quot;File&quot; value=&quot;/var/tomcat4/logs/log4j.log&quot;/>
<param name=&quot;Append&quot; value=&quot;false&quot;/>
<layout class=&quot;org.apache.log4j.PatternLayout&quot;>
<param name=&quot;ConversionPattern&quot; value=&quot;[%d{HH:mm:ss}] [%-12C] [%p] - %m%n&quot;/>
</layout>
</appender>

<root>
<priority value =&quot;info&quot;/>
<appender-ref ref=&quot;appender&quot;/>
</root>

</log4j:configuration>

What I want to do now is to set up additional configuraton files to allow my customers to generate logs within their own virtual hosting environments and applications. I have tried uploading a log4j.xml file like that shown below to the WEB-INF/classes directory of an application that I know is generating errors in catalina.out, but I get no logs generated.

Does anyone know how to set up log4j in a virtual hosting environment, as I can't find information on how to do this anywhere.

This is my application level log4j.xml :

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

<log4j:configuration xmlns:log4j=&quot;
<appender name=&quot;wasugAppender&quot; class=&quot;org.apache.log4j.RollingFileAppender&quot;>
<param name=&quot;File&quot; value=&quot;/home/virtual/websphereusergroup.org.uk/var/log/log4j.log&quot;/>
<param name=&quot;Append&quot; value=&quot;false&quot;/>
<layout class=&quot;org.apache.log4j.PatternLayout&quot;>
<param name=&quot;ConversionPattern&quot; value=&quot;[%d{HH:mm:ss}] [%-12C] [%p] - %m%n&quot;/>
</layout>
</appender>

<root>
<priority value =&quot;info&quot;/>
<appender-ref ref=&quot;appender&quot;/>
</root>

</log4j:configuration>

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top