Quantcast
Channel: How to find out the log file name that a currently running process is writing to? - Server Fault
Viewing all articles
Browse latest Browse all 2

How to find out the log file name that a currently running process is writing to?

0
0

We've setup a cron-based invocation of a Java program every minute. This Java program invocation is written in a shell script and is setup as cron job. Each invoked Java program is directed to its own separate log file (using date & time as file name with precision upto minutes) as shown below:

calljavaprogram.sh

DATE=`date +%Y-%m-%d_%H-%M`
/usr/java/jdk1.6.0/bin/java -Xms512m -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError MyJavaProgram 2>&1 >> $DATE.log | tee -a $DATE.err >> $DATE.log &

For example, I can find out the currently running Java process (MyJavaProgram) at any time using the following command:

[root@user ~]# ps -ef |grep MyJavaProgram
user    4321     1  0 Oct17 ?        00:00:17 /usr/java/jdk1.6.0/bin/java -Xms512m -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError MyJavaProgram
user    5747     1  0 Oct17 ?        00:00:11 /usr/java/jdk1.6.0/bin/java -Xms512m -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError MyJavaProgram

My question is, I want to find out the actual log file name to which the currently executing Java process (MyJavaProgram) is writing to. So, for example, if there are 2 MyJavaProgram currently executing, I want to know the log file name of each process. In this case, I'm interested/want to know the .log extension file, though there are 2 extensions - .log and .err.

NOTE: Log file name is generated in this pattern, 2011-10-17_19-28.log, for example. Our server is RHEL4.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images