Wednesday, July 14, 2010

File in Use

What if the logs / files that the weblogic server is currently writing to grows large in size and you need to compress it.

Well if you simple zip a file the weblogic server is currently writing to, the weblogic server will stop logging. Only after the process (java weblogic process) restart, will the logging take effect.

What if this is a production environment. Would you simple bring down production instance inorder to be able to zip a file.

The solution is:

1. Go to the file location which you wish to compress.

2. cp filename /tmp/backup

3. Copy that file to '/tmp/backup' location

4. >filename

>filename (this process is called trimming)

5. cd /tmp/backup/

(Go to the backup folder)

6. gzip filename

It will create a filename.gz

The best approach however is rotation of the log files feature available with weblogic.

If your log file is growing in size and not rotating then your weblogic server instance may be running in development mode, where the log file is rotated only on server restart.

Thus, its suggested to run the server in production mode.

Windows Operating System does not provide any handle have a similar feature of trimming a log file which is in production and therefore no third party tools or scripts would help.

Kindly comment if I am mistaken or questions/queries or suggestions you may have.

No comments:

Post a Comment