Difference between revisions of "Tomcat 5"

From Briki
Jump to: navigation, search
Line 12: Line 12:
 
Error is '''javax.naming.NamingException: /usr/share/tomcat5/conf/tomcat-users.xml.new (Permission denied)'''<br>
 
Error is '''javax.naming.NamingException: /usr/share/tomcat5/conf/tomcat-users.xml.new (Permission denied)'''<br>
 
# '''chown tomcat:tomcat /etc/tomcat5''' (NB. '''/usr/share/tomcat5/conf''' is a symlink to '''/etc/tomcat5''')
 
# '''chown tomcat:tomcat /etc/tomcat5''' (NB. '''/usr/share/tomcat5/conf''' is a symlink to '''/etc/tomcat5''')
 +
 +
 +
== Changing to use log4j logging ==
 +
<ol>
 +
<li> Ensure log4j.jar and commons-logging.jar (or symlinks to them) are present is '''/usr/share/tomcat5/common/lib'''
 +
<li> Create file '''/usr/share/tomcat5/common/classes/log4j.properties''' with contents:
 +
<pre>
 +
log4j.rootLogger=INFO, FileAppender
 +
 +
log4j.appender.FileAppender=org.apache.log4j.RollingFileAppender
 +
log4j.appender.FileAppender.File=/var/log/tomcat5/tomcat.log
 +
log4j.appender.FileAppender.layout=org.apache.log4j.PatternLayout
 +
# Print the date in ISO 8601 format
 +
log4j.appender.FileAppender.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
 +
log4j.appender.FileAppender.MaxFileSize=1MB
 +
log4j.appender.FileAppender.MaxBackupIndex=4
 +
 +
#log4j.logger.org.apache=DEBUG
 +
</pre>
 +
 +
<li> Comment out '''Logger''' section in '''/usr/share/tomcat5/conf/server.xml'''
 +
<li> Create empty file '''/var/log/tomcat5/tomcat.log''' (tomcat complains without this, for some reason)
 +
</ol>

Revision as of 17:02, 20 February 2006

Tidying up /etc/init.d/tomcat5 output

  1. In /etc/init.d/tomcat5
    1. Remove if statement around . /etc/init.d/rc.d/functions
    2. Change echo "waiting for processes to exit" to echo -n "."
    3. Add success after start and stop commands
  2. In /usr/bin/dtomcat5
    1. Comment out Using... lines
  3. In /usr/share/tomcat5/bin/relink
    1. Reorder find arguments to put -type d after mindepth and maxdepth arguments

Fixing tomcat-users.xml.new error

Error is javax.naming.NamingException: /usr/share/tomcat5/conf/tomcat-users.xml.new (Permission denied)

  1. chown tomcat:tomcat /etc/tomcat5 (NB. /usr/share/tomcat5/conf is a symlink to /etc/tomcat5)


Changing to use log4j logging

  1. Ensure log4j.jar and commons-logging.jar (or symlinks to them) are present is /usr/share/tomcat5/common/lib
  2. Create file /usr/share/tomcat5/common/classes/log4j.properties with contents:
    log4j.rootLogger=INFO, FileAppender
    
    log4j.appender.FileAppender=org.apache.log4j.RollingFileAppender
    log4j.appender.FileAppender.File=/var/log/tomcat5/tomcat.log
    log4j.appender.FileAppender.layout=org.apache.log4j.PatternLayout
    # Print the date in ISO 8601 format
    log4j.appender.FileAppender.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
    log4j.appender.FileAppender.MaxFileSize=1MB
    log4j.appender.FileAppender.MaxBackupIndex=4
    
    #log4j.logger.org.apache=DEBUG
    
  3. Comment out Logger section in /usr/share/tomcat5/conf/server.xml
  4. Create empty file /var/log/tomcat5/tomcat.log (tomcat complains without this, for some reason)