6/25/2010

GlassFish rotate-log

GlassFish has a command to rotate or reset server.log file:

$GLASSFISH_HOME/bin/asadmin rotate-log
After running this command the logs directory looks like this:
/glassfish-3.1/glassfish/domains/domain1/logs > ll
total 200
-rw-r--r-- 1 root 0 Jun 25 10:11 server.log
-rw-r--r-- 1 root 10780 Jun 25 10:11 server.log_2010-06-25T10-09-48
-rw-r--r-- 1 root 16384 Jun 25 10:10 jvm.log
drwxr-xr-x 3 root 102 Jun 25 10:02 server/
This command renames server.log file to a timestamped backup file, and leaves the current server.log file empty. I usually run this command before starting a test run to make sure the current server.log only contains logs from this test run.

For convenience, I also have an alias for it (in tcsh syntax):
alias rlog '$GLASSFISH_HOME/bin/asadmin rotate-log'
For more details, see official docs, or view the online help:
$GLASSFISH_HOME/bin/asadmin rotate-log --help

2 comments:

Steve Smith said...

Great and Useful Article.

Online Java Training

Java Online Training India

Java Online Course

Java EE course

Java EE training

Best Recommended books for Spring framework

Java Interview Questions








Java Course in Chennai

Java Online Training India

Vũ Diệu Linh said...

I enjoyed on reading your blog post. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. Please visit my website, Friv 4000 Games is where all the free friv games.
Friv 4000