Tomcat view catalina.out log file - linux

In Red Hat,
cd /var/lib/tomcat
tail -f logs/catalina.out
I can see the log in the console.
In Ubuntu,
cd /var/lib/tomcat6
tail -f logs/catalina.out
Nothing show out in the console.
May I know what is the problem? Which configuration that I need to look to?

Tomcat 7 Ubuntu Server 12.04 LTS:
tail -f /var/log/tomcat7/catalina.out

locate catalina.out and find out where is your catalina out. Because it depends.
If there is several, look at their sizes: that with size 0 are not what you want.

cd /usr/local/tomcat/logs
tail -f catalina.out

Sometimes it is located in different places. It depends on the server.
You can use find to find it:
find / -name catalina.out
If you encounter permission issues, add sudo to the command:
sudo find / -name catalina.out
That's all.
I hope this helps

I found mine at
~/apache-tomcat-7.0.25/logs/catalina.out

Try using this:
sudo tail -f /opt/tomcat/logs/catalina.out

It works for me on Ubuntu...
cd var/lib/tomcat7
sudo nano logs/catalina.out

I have used this command to check the logs and 10000 is used to show the number of lines
sudo tail -10000f catalina.out

Just logged in to the server and type below command
locate catalina.out
It will show all the locations where catalina file exist within this server.

Just be aware also that catalina.out can be renamed - it can be set in /bin/catalina.sh with the CATALINA_OUT environment variable.

If you are in the home directory first move to apache tomcat use below command
cd apache-tomcat/
then move to logs
cd logs/
then open the catelina.out use the below command
tail -f catalina.out

If you type in the command line
catalina
you will see some message about it, look for this:
CATALINA_BASE: /usr/local/Cellar/tomcat/9.0.27/libexec
cd /usr/local/Cellar/tomcat/9.0.27/libexec/logs
tail -f catalina.out
You will then see the live logs.
NOTE: My Tomcat installation was done via Homebrew

I found logs of Apache Tomcat/9.0.33 version in below path:
In tail -f /opt/tomcat/logs/catalina.out
Thanks.

Related

Nodemon Error: "System limit for number of file watchers reached"

I'm learning GraphQL and am using prisma-binding for GraphQL operations. I'm facing this nodemon error while I'm starting my Node.js server and its giving me the path of schema file which is auto generated by a graphql-cli. What is this error all about?
Error:
Internal watch failed: ENOSPC: System limit for number of file watchers reached, watch '/media/rehan-sattar/Development/All projects/GrpahQl/graph-ql-course/graphql-prisma/src/generated
If you are using Linux, your project is hitting your system's file watchers limit
To fix this, on your terminal, try:
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
You need to increase the inotify watchers limit for users of your system. You can do this from the command line with:
sudo sysctl -w fs.inotify.max_user_watches=100000
That will persist only until you reboot, though. To make this permanent, add a file named /etc/sysctl.d/10-user-watches.conf with the following contents:
fs.inotify.max_user_watches = 100000
After making the above (or any other) change, you can reload the settings from all sysctl configuration files in /etc with sudo sysctl --system. (On older systems you may need to use sudo sysctl -p instead.)
I sometimes get this issue when working with Visual Studio Code on my Ubuntu machine.
In my case the following workaround helps:
Stop the watcher, close Visual Studio Code, start the watcher, and open Visual Studio Code again.
In order to test the changes, I temporary set the parameter with the value 524288.
sysctl -w fs.inotify.max_user_watches=524288
Then I proceed to validate:
npm run serve
And the problem was solved. In order to make it permanent, you should try to add a line in the file "/etc/sysctl.conf" and then restart the sysctl service:
cat /etc/sysctl.conf | tail -n 2
fs.inotify.max_user_watches=524288
sudo systemctl restart systemd-sysctl.service
I had the same problem. However, mine was coming from Webpack. Thankfully, they had a great solution on their site:
For some systems, watching many files can result in a lot of CPU or memory usage. It is possible to exclude a huge folder like node_modules using a regular expression:
File webpack.config.js
module.exports = {
watchOptions: {
ignored: /node_modules/
}
};
This is a problem of inotify (inode notify) in the Linux kernel, so you can resolve it by using this command:
For a temporary solution until rebooting the pc, use the following command
sudo sysctl -w fs.inotify.max_user_watches=100000
A permanent solution: To make this permanent, add a file named /etc/sysctl.d/10-user-watches.conf with the following contents:
fs.inotify.max_user_watches = 10000
After making the change, reload the settings from all sysctl configuration files in /etc with sudo sysctl -p.
It can be hard to know how much to increase the number of watchers by. So, here's a utility to double the number of watchers:
function get_inode_watcher_count() {
find /proc/*/fd -user "$USER" -lname anon_inode:inotify -printf '%hinfo/%f\n' 2>/dev/null |
xargs cat |
grep -c '^inotify'
}
function set_inode_watchers() {
sudo sysctl -w fs.inotify.max_user_watches="$1"
}
function double_inode_watchers() {
watcher_count="$(get_inode_watcher_count)"
set_inode_watchers "$((watcher_count * 2))"
if test "$1" = "-p" || test "$1" = "--persist"; then
echo "fs.inotify.max_user_watches = $((watcher_count * 2))" > /etc/sysctl.d/10-user-watches.conf
fi
}
# Usage
double_inode_watchers
# to make the change persistent
double_inode_watchers --persist
In my case, while I'm doing the nodemon command on the Linux server, I have my Visual Studio Code open (SSH to the server). So based on Juri Sinitson's answer, I just close Visual Studio Code and run the nodemon command again. And it works.
My nodemon command:
nodemon server.js via npm start
I think most answers given here are correct, but using the systemctl command to restart my service solved the problem for me. Check the command below:
sudo systemctl restart systemd-sysctl.service
You should follow answers such as this one:
cjs'
Or:
Isac Moura's
And for latest Ubuntu versions, run sudo sysctl --system to read these settings anew.
However, in my case, my changes to these configuration files were not picked up, because I had already tweaked these settings a while ago... and forgot about it. And I had placed the conflicting configuration file in the wrong place.
According to man sysctl.d, these settings can be placed in /etc/sysctl.d/*.conf, /run/sysctl.d/*.conf and /usr/lib/sysctl.d/*.conf.
In my case I had two files:
/etc/sysctl.d/10-user-watches.conf
/usr/lib/sysctl.d/30-tracker.conf <<< Older file, with lower limit
Due to the naming convention, my older file was read last, and took precedence.
On Linux, I've actually run with sudo.
sudo npm start

Install rabbitmqadmin on linux

I'm trying to install and be able to run rabbitmqadmin on a linux machine. Following the instructions described here do not help.
After downloading the file linked, it prompts to copy the file (which looks like a python script) into /usr/local/bin.
Trying to run it by simply invoking rabbitmqadmin results in rabbitmqadmin: command not found. There seems to be no information anywhere about how to get this to work and assumes that all the steps listed on the site should work for all. It seems odd that simply copying a python script to the bin folder should allow it to become a recognised command without having to invoke the python interpreter every time.
Any help is appreciated.
I spent several hours to figure out this, use rabbitmqadmin on linux environment, Finally below steps solve my issue.
On my ubuntu server, python3 was installed, I checked it using below command,
python3 -V
Step 1: download the python script to your linux server
wget https://raw.githubusercontent.com/rabbitmq/rabbitmq-management/v3.7.8/bin/rabbitmqadmin
Step2: change the permission
chmod 777 rabbitmqadmin
Step3: change the header of the script as below(first line)
#!/usr/bin/env python3
Thant's all, Now you can run below commands,
To list down queues,
./rabbitmqadmin -f tsv -q list queues
To Delete ques,
./rabbitmqadmin delete queue name=name_of_queue
To add binding between exchange and queue
./rabbitmqadmin declare binding source="exchangename" destination_type="queue" destination="queuename" routing_key="routingkey"
RabbitMQ decided to omit one vital piece of information.
Make the script executable with chmod +x otherwise it will fail to work.
I want to post my commands for installing rabbitmqadmin, it is combination of other answers, but with a little improvements for using best practice:
sudo rabbitmq-plugins enable rabbitmq_management
wget 'https://raw.githubusercontent.com/rabbitmq/rabbitmq-management/v3.7.15/bin/rabbitmqadmin'
chmod +x rabbitmqadmin
sed -i 's|#!/usr/bin/env python|#!/usr/bin/env python3|' rabbitmqadmin
mv rabbitmqadmin .local/bin/
rabbitmqadmin -q list queues
I suppose that you already create .local/bin/ dir and add it to PATH (on Ubuntu bash add this dir to PATH if it exists).
After install Rabbbitmq on Ubuntu/Debian, you can activate the Rabbitmq Admin Portal using the next command:
rabbitmq-plugins enable rabbitmq_management
Then you can access to the portal from http://localhost:15672. Use the user/password "guest".
Below the steps to install rabbimqadmin:
cd /usr/local/bin/
wget http://127.0.0.1:15672/cli/rabbitmqadmin
chmod 777 rabbitmqadmin
For more details check the official documentation Obtaining rabbitmqadmin

linux commands mkdir, rm -r and ln -s -T in processing phase of IZPack 5.0.0

I am using JBoss 7.1.1 application server with my java application in linux and have successfully been able to start JBoss during the processing phase of IZPack(processSpec.xml). I was getting "command not found" messages during the processing phase. I decided to get rid of all the comments and the messages went away. However, when I execute the uninstall, mkdir and ln -s -T appends a "?" at the end of the filename and link. Is this a bug? The rm -r successfuly removes the jboss script at /etc/init.d, but fails to remove the jboss-as.conf file at /etc/jboss-7.1.1.Final. I have jboss home at /usr/share. rm -r fails to remove /standalone and /modules. I get a popup during the uninstall stating administrative priveleges are required to remove /standalone and /modules.
All input is appreciated.
Glenn
rm(1) man page notes :
Otherwise, if a file is unwritable, standard input is a terminal, and the -f or --force option is not given, or the -i or
--interactive=always option is given, rm prompts the user for whether to remove the file. If the response is not affirma-tive, the file is skipped.
That appended ? after filename sounds like the prompt.
You're trying to remove files, that's readonly. rm -r is failing to remove things, probably because you don't own /standalone and /modules. Presumbably you needed "administrative privileges" to get things installed where they are in first place.

Unable to start CouchDB

Just installed CouchDb using brew on mac mountain lion. Everything went well till I hit the following issue to start the server I do not know erlnag and could not analyze the dump file
`couchdb
Apache CouchDB 1.2.1 (LogLevel=info) is starting.
{"init terminating in do_boot",{{badmatch,{error,{bad_return,{{couch_app,start,[normal,["/usr/local/etc/couchdb/default.ini","/usr/local/etc/couchdb/local.ini"]]},{'EXIT',{{badmatch,{error,shutdown}},[{couch_server_sup,start_server,1,[{file,"couch_server_sup.erl"},{line,98}]},{application_master,start_it_old,4,[{file,"application_master.erl"},{line,274}]}]}}}}}},[{couch,start,0,[{file,"couch.erl"},{line,18}]},{init,start_it,1,[]},{init,start_em,1,[]}]}}
Crash dump was written to: erl_crash.dump
init terminating in do_boot ()`
Any help much appreciated.
I have left the configurations files as it is
Often this is due to incorrect permissions on various configuration files & directories. It can be caused by running as a sudo / root user for example.
You can try fixing this using the following, but you may need to either create/add yourself to a couchdb group, or use a different user:group combination.
sudo chown -R couchdb:couchdb /etc/couchdb /var/lib/couchdb /var/run/couchdb /var/log/couchdb
sudo chmod -R 770 /etc/couchdb /var/lib/couchdb /var/run/couchdb /var/log/couchdb
sudo find /etc/couchdb /var/lib/couchdb /var/run/couchdb /var/log/couchdb -type f | sudo xargs chmod 660
```
See the chmod section in http://wiki.apache.org/couchdb/Installing_on_OSX for more detail.
I've had this problem when attempting to load a configuration file that doesn't exist, I was starting CouchDB with the -a option to supply additional configuration, and if that file doesn't exist I get an error similar to the one reported:
$ couchdb -a /does/not/exist.ini
{"init terminating in do_boot",{{badmatch,{error,{bad_return,{{couch_app,start,[normal,["/usr/local/etc/couchdb/default.ini","/usr/local/etc/couchdb/local.ini"]]},{'EXIT',{{badmatch,{error,{error,enoent}}},[{couch_server_sup,start_server,1,[{file,"couch_server_sup.erl"},{line,56}]},{application_master,start_it_old,4,[{file,"application_master.erl"},{line,269}]}]}}}}}},[{couch,start,0,[{file,"couch.erl"},{line,18}]},{init,start_it,1,[]},{init,start_em,1,[]}]}}
sudo apt-get install libicu-dev
Provide Proper permissions

starting apachectl from bash

I am writing a bash file. I need to start apachectl from my bash file. so i wrote:
apachectl start
When I run it with root, an error occurred:
apachectl: command not found
I searched and I found that, I should be super user with su - not su
Now, I want to know:
why this error occurred?
How could i run it with su?
In shell scripts you should use full paths in order to execute command unless directory with executable already in $PATH.
For instance, find where apachectl binary is located:
which apachectl
or
whereis apachectl
and you will get something like:
/usr/local/sbin/apachectl
So, use that.
The command not found error is because "apachectl" is not in your path. Simply use the full path of the command, e.g.
/etc/init.d/apachectl start
If you get a permission denied error, then you need to run as a different user. That is a different problem though.
Use the find command to first locate apachecetl
find / -name apachectl
Then you can test it by running the status command (assuming this is the location from the find command)
/usr/local/sbin/apachectl status
Then you may need to restart apache if there's an issue
/usr/local/apache/bin/apachectl restart
It seems, that the command apachectl is not in your environments path. Locate the directory, where apachectl resides and add this to your PATH or start it with the full path. Most modern distributions use sudo to allow users gain elevated rights, so you should use sudo, if available to you.
Below command worked for me:
sudo /usr/sbin/apachectl -kstart
The answer above helped me a lot but the commands should be:
sudo netstat -tanp
sudo ss -tanp 'sport = 80'
sudo apt-get remove lighttpd
sudo <path>/apachectl -kstart
First kill all httpd service using...
sudo killall -9 httpd
Second, find apachectl. Press ctrl+r into terminal enter a "apachectl" word To find the path of "apachectl".
After select:
sudo <path>/apachectl stop|start
This question is old but comes up in Google, so for future readers: Please notice on some distributions such as Debian it is a sudo-only command and trying to run it without sudo leads to the error: command not found. So in order to run it simply use sudo. Also if you want to know where the binary is located at too, the simplest way I recommend (if using APT) is:
$ dpkg -L apache2 | grep apachectl
/usr/sbin/apachectl
/usr/share/man/man8/apachectl.8.gz
As you see, it's under sbin which means is exclusive to admins space.
I had the same problem. You may run the following command first:
export PATH=$PATH:/sbin
Then use apachectl restart or etc.
well, it happens why you port be used now other service. for you know that
service is use write next comand of netstat:
sudo netstat -tanp.
if you wanna to know of port 8080 use next comand:
trong textsudo ss -ntlp 'sport = 80'.
in my case was run lighttpd so apply next comand:
sudo apt-get remove lighttpd.

Resources