Is there any way to keep logs (errors) on ubuntu?

68 Views Asked by At

Is there any way to keep logs (errors) on ubuntu? If there is could you please share methods how to achieve this.

I have a server which is running on ubuntu and periodically crashes. Wanted to keep the log of all errors which occur at the runtime.

Does anyone know why it happens? The server just stops to respond but the command "ps -ef | grep java" returns that it is working...

1

There are 1 best solutions below

0
On

Normally every server(assuming standard server ex apache, nginx) do there own logging. If you are building your own server you need to add logging on your own.

Normal logs are send to /var/log directory unless stated otherwise in configuration file of server. Also in some servers(software in general) you need to enable logging from configuration files and most of the time it also contains default path of logs which one can modify to send those logs to custom directory.

This is very generic answer and you need to specify your problem in more detail. You need to tell what server you are running and if it is custom build then you need to provide code.

ps -ef|grep java shows running does not mean that it is running properly. Any process has various states in which it can go. So you need to know in what state your program is running. Try ps -axu | grep java.