35

I installed Tomcat6 on a Ubuntu 9.04 server using apt-get install tomcat6. I uploaded a WAR using the manager interface and tried to start the application but get a pretty generic error on the Web interface saying it couldn't be started.

I am trying to find the logs to determine why my war won't start (I suspect low memory as i'm on a small VPS) but I don't know where they are.

/var/lib/tomcat6/logs is empty. My Tomcat splash page reliably informs me of the following;

Tomcat is installed with CATALINA_HOME in /usr/share/tomcat6 
CATALINA_BASE in /var/lib/tomcat6, 
following the rules from /usr/share/doc/tomcat6-common/RUNNING.txt.gz.

UPDATE

I tried running;

$ ps -ax 
/usr/bin/jsvc -user tomcat6 -cp /usr/share/java/commons-daemon.jar:/usr/share/tomcat6/bin/bootstrap.jar -outfile SYSLOG -errfile SYSLOG -pidfile /var/run/tomcat6.pid

But there is nothing in /var/log/syslog

Also runing

$ losof -p PID

didn't show any log files...

$  for PID in $(pgrep jsvc);do sudo ls -l /proc/$PID/fd|grep ' 1 -> ';done
l-wx------ 1 root 500 64 2010-03-30 13:29 1 -> pipe:[301470406]
lrwx------ 1 root 500 64 2010-03-30 13:29 1 -> /dev/null
l-wx------ 1 root root 64 2010-03-30 13:29 1 -> pipe:[301470406]

Thanks,

Gav

6 Answers 6

9

Very late to this discussion, but it appears that the 03catalina.policy file in both tomcat5.5 & tomcat6 doesn't actually permit writing to logfiles.

The simplest solution is to change the JULI permissions to:

// These permissions apply to JULI
grant codeBase "file:${catalina.home}/bin/tomcat-juli.jar" {
    permission java.security.AllPermission;
};

Obviously, there may be security issues I'm not aware of, but I really can't be bothered to dig deeper - I've spent too long on this myself.

1
  • Thanks for the update, I never did get this working myself and now that VPS is dead. It makes sense to me that the logs weren't being written as I never saw a handle open when firing up the server.
    – gav
    Jul 26, 2012 at 17:59
39

A neat trick is to run the command "lsof -p PID" where PID is the process id of your tomcat server. This command will give you a list of all files opened by the process, including the log file. See Wikipedia page.

3
  • That's an awesome tip! Unfortunately none of my processes have hold of a log file... not sure what that means.
    – gav
    Mar 30, 2010 at 13:31
  • 2
    It could mean that the process could not open the log file. You should have some errors logged on console/STDOUT. If you are using Linux you can try for PID in $(pgrep java);do sudo ls -l /proc/$PID/fd|grep ' 1 -> ';done Mar 30, 2010 at 13:38
  • Using apt-get to install Tomcat means that it's configured to run as a daemon using jsvc. Just required a change in your command to (java -> jsvc). The snippet returned the output at the bottom of my question (Comment formatting is unreadable).
    – gav
    Mar 30, 2010 at 13:47
25

By default check

/var/log/tomcat6/catalina.out 

or something like that

and check logging properties in

/usr/share/tomcat6/conf/logging.properties

usually /usr/share/tomcat6/conf/ is symbolic link to /etc/tomcat6/

1
  • /var/log/tomcat6/catalina.out doesn't exist and neither does the folder /usr/share/tomcat6/conf. /etc/tomcat6/logging.properties suggests that ${catalina.base}/logs is the directory i'm looking for but as I said, nothing is written there. Ho hum :(
    – gav
    Mar 30, 2010 at 13:34
11

They should be at CATALINA_HOME/logs

I've seen it most often at /opt/tomcat/logs, but in your case it might be /usr/share/logs

3

By default Tomcat logs are in /var/log/tomcat? and /var/lib/tomcat7/logs usually points to there.

As root, you may check them by:

tail -f /var/log/tomcat7/*.log /var/log/tomcat7/*.txt /var/log/tomcat7/*.out

If you still have any issues, try finding them via:

sudo lsof | grep -E "java.*(out|txt|log)$"
1

we can find logs like below for Windows. C:\Program Files\Apache Software Foundation\Tomcat 9.0\logs

also refer C:\Program Files\Apache Software Foundation\Tomcat 9.0\conf\logging-properties.

3
  • 3
    The question as posted is referring to a Linux (Ubuntu specifically) installation. The answer you gave is for a Windows-based installation. Also, this question already has an accepted answer.
    – Corey S.
    Jun 20, 2018 at 0:34
  • For folks who might have gotten here from a Google search for "Tomcat log directory", this answer is actually MORE helpful than the accepted answer!
    – paulsm4
    Aug 25, 2020 at 17:39
  • The question might have been about Ubuntu, but the title wasn't.
    – Dakkaron
    Nov 5, 2020 at 10:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .