简体   繁体   中英

Catalina.out doesn't exist

I want to read my console output logs, and I know that they are stored into "log" folder under the file catalina.out, but it doesn't exists. I have tried in different ways with no results, I don't know how to figure it out, I just want to see my java outputs logs

If the catalina.out is deleted after tomcat is stopped, it will create a new catalina.out once tomcat starts again and it is totally safe.

But if you remove the catalina.out while tomcat is running, it will keep on logging to catalina.out which is removed already (reference of the file is hold by the tomcat ) hence the space will not be released. So you will need to restart the tomcat sever to release the space. It is not recommended.

Start/ Run Tomcat server and it should create catalina.out file without any error.

Following are the multiple ways of running tomcat. Just indicated in detail so this would help someone in need.

./catalina.sh run

Passing "run" argument for catalina.sh --> starts the Tomcat in the foreground and displays the running logs in the same console . when the console terminal is closed it will terminate the tomcat .

./catalina.sh start

Passing "start" argument for catalina.sh --> starts the Tomcat in the background . Since in background no issues closing down the terminal. The logs need to be viewed as below: tail -f $CATALINA_HOME/logs/catalina.out

./startup.sh 

The last way is firing the startup.sh to start your Tomcat server. If you Vi the script you can see it calls catalina.sh script passing start as the argument . This will be running in background as well.

Now check your tomcat log directory and you should find the catalina.out

go to the bin folder of tomcat and run below script ./catalina.sh start

now catalina.out exist in logs folder

From catalina.sh , it says :

#   CATALINA_OUT    (Optional) Full path to a file where stdout and stderr
#                   will be redirected.
#                   Default is $CATALINA_BASE/logs/catalina.out

So , look at your script that is used to start Tomcat to find out what the value of the environment variable CATALINA_OUT .

When we upgraded our Beanstalks to Tomcat 8.5 with Corretto 11 running on 64bit Amazon Linux 2 , catalina.out no longer existed and not all logs were present in catalina. date .log. We re-established the catalina.out with the following file dropped into /etc/rsyslog.d/catalina.conf

$umask 0000
$FileCreateMode 0644
template(name="Tomcat" type="string" string="%msg%\n") {
  property(name="msg")
}
if $programname == 'tomcat' then {
    action(type="omfile" file="/var/log/tomcat/catalina.out" template="Tomcat")
}
if  $programname == 'server' then {
    action(type="omfile" file="/var/log/tomcat/catalina.out" template="Tomcat")
}

you will want to restart rsyslog afterwards.

service rsyslog restart

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM