Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Summary

Freshly-installed (via apt-get) Tomcat on a freshly-installed Ubuntu 8.04 LTS 64-bit works, but doesn't (seem to) log anything. See also "What I've Tried" and "Closing In On It" below.

More Detail

Because the package maintainers have done a HUGE amount of the work, getting basic things working has been a fairly straightfoward matter of running apt-get and pointing Tomcat at the right JDK. And it works. But it doesn't appear to log anything.

As far as I can tell, the logging infrastructure is controlled via logging.properties files (since this is Tomcat 5.5, not Tomcat 5.0), including a central one (which you can override per web app) at /etc/tomcat55/logging.properties (/etc/tomcat55 is symlinked as /var/lib/tomcat55/conf). I'm not overriding it, and I can't see why I'm not seeing something. Here's the file:

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

handlers = 1catalina.org.apache.juli.FileHandler, 2localhost.org.apache.juli.FileHandler, 3manager.org.apache.juli.FileHandler, 4admin.org.apache.juli.FileHandler, 5host-manager.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler

.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler

############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################

1catalina.org.apache.juli.FileHandler.level = FINE
1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
1catalina.org.apache.juli.FileHandler.prefix = catalina.

2localhost.org.apache.juli.FileHandler.level = FINE
2localhost.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
2localhost.org.apache.juli.FileHandler.prefix = localhost.

3manager.org.apache.juli.FileHandler.level = FINE
3manager.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
3manager.org.apache.juli.FileHandler.prefix = manager.

4admin.org.apache.juli.FileHandler.level = FINE
4admin.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
4admin.org.apache.juli.FileHandler.prefix = admin.

5host-manager.org.apache.juli.FileHandler.level = FINE
5host-manager.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
5host-manager.org.apache.juli.FileHandler.prefix = host-manager.

java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter


############################################################
# Facility specific properties.
# Provides extra control for each logger.
############################################################

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = DEBUG
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 2localhost.org.apache.juli.FileHandler

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handlers = 3manager.org.apache.juli.FileHandler

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/admin].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/admin].handlers = 4admin.org.apache.juli.FileHandler

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].handlers = 5host-manager.org.apache.juli.FileHandler

# For example, set the com.xyz.foo logger to only log SEVERE
# messages:
#org.apache.catalina.startup.ContextConfig.level = DEBUG
#org.apache.catalina.startup.HostConfig.level = DEBUG
#org.apache.catalina.session.ManagerBase.level = DEBUG

The only change I've made is:

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = DEBUG

...which was set to INFO like all the others, but I wanted to get it to log something, so I upped it to DEBUG. Naturally I've restarted Tomcat.

I can compile and view a JSP, so again Tomcat is working, but /var/lib/tomcat5.5/logs is stubbornly empty. Even if I force an error by having an invalid JSP or some such, I'm getting nothing.

What I've Tried

  • I've been through the steps listed in the Tomcat FAQ for ensuring that the distro hasn't messed things up (they hadn't).
  • I've gone looking for a logs directory elsewhere in case it's not /var/lib/tomcat5.5/logs (although that was created by the install).
  • Naturally I've restarted Tomcat after making any changes.

One thing I haven't done is to chown everything to be owned by the tomcat55 user that the install created. logs is owned by tomcat55, but a number of the other directories and files are owned by root, though they're world-readable. I haven't done this because (hangs head) I can't quite figure out how to fully back-up the existing tree so I can readily undo the change. The blasted tree has absolute symlinks interweaving /etc/tomcat55, /var/lib/tomcat55, and /usr/share/tomcat55 that I know of. I could tar up each of those, but I don't know for certain I'm not missing something.

EDIT:

Closing In On It

Okay, so I've found that it's writing console-style stuff to /var/log/daemon.log. Whew! At least that gives me a place to start. And it's issuing complaints like:

jsvc.exec[18819]: Can't load log handler "2localhost.org.apache.juli.FileHandler"
jsvc.exec[18819]: java.lang.ClassNotFoundException: 2localhost.org.apache.juli.FileHandler

And I'm not surprised, 2localhost.org.apache.juli.FileHandler isn't a valid class name (packages can't start with digits!). So I'm suspecting that the default logging.properties file is...not good. Will report back.

share|improve this question

2 Answers 2

up vote 4 down vote accepted

I figured it out -- the package doesn't quite work right with Sun's latest Java6 package, sun-java6-jdk; the fix is fairly straightforward when you find it:

Once I found the daemon.log, I found the errors listed in my edit on the question, but those are just a side-effect of this error:

jsvc.exec[18819]: Could not load Logmanager "org.apache.juli.ClassLoaderLogManager"
jsvc.exec[18819]: java.security.AccessControlException: access denied (java.lang.RuntimePermission setContextClassLoader)

...which occurs because the package, by default, runs Tomcat using the Java security manager per this setting in /etc/init.d/tomcat5.5:

# Use the Java security manager? (yes/no)
TOMCAT5_SECURITY=yes

...but the package doesn't set a permissions on JULI (the default logging implementation) that the latest Java6 from Sun appears to need for that to work. Earlier versions of Java6 were apparently fine. This recent thread on the tomcat-user mailing list pointed me in the right direction; the user in question there was getting the error above and eventually Mark Thomas figured out that this permission:

permission java.lang.RuntimePermission "setContextClassLoader";

...was missing from catalina.policy. And indeed, if I add that permission to the JULI section of /etc/tomcat5.5/policy.d/03catalina.policy and restart Tmocat, the error goes away, and I get log files! Huzzah!

Be warned: If you also install tomcat5.5-webapps to get the examples, manager application, etc., there are other settings you'll need to enable in 03catalina.policy. Of course, you always have the option of turning the security manager off, but this is what it's for.

share|improve this answer

All the official bug report about that problem is here : https://bugs.launchpad.net/ubuntu/+source/tomcat5.5/+bug/410379

share|improve this answer
    
Thanks for the link! –  T.J. Crowder Dec 7 '09 at 15:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.