6/16/14

truncate live file

How to truncate a live log file? 
Some situations force us to truncate live log file.
Simple way to truncate a live log file is -
as the owner of the file
> logfilename

this truncates the log

Thread Dumps

Aften as process admin, we need to take thread dump.
Thread dump gives you what the jvm threads are doing, what are their status and so on info.

1. WebSphere
We can take WebSphere JVM thread by using this command
kill -3 jvmpid

This generates thread dump, by default dumps the threads to jvm/logs/jvmname/natviestdout
You can configure the jvm to generate generate file in your configured path.
2. Tomcat
/path/to/jdk/bin/jstack -l pid > nameoffile.log
You need to take thread dump as the owner of the pid. Better to use the same jdk as tomcat. As the owner of tomcat, you can say "which java" or ps -ef | grep -i java gives which java tomcat process pointed to.

3. WebLogic
kill -3 or jstack can be used.

[There are several ways. These are few]