Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am running this tool called yajsw which generates a log file named as wrapper.log.0. What I notice after sometime it becomes too big and I cannot run the zip command too? Can I run a cron job to daily flush the log file into individual daily log files? Any idea how to do it?

share|improve this question

2 Answers 2

up vote 6 down vote accepted

Looking at the documentation it appears that you can configure yajsw to roll it's logs when

wrapper.logfile.maxsize is reached

The wrapper.log file can be set to roll when the file reaches a specified size. The default value of 0 will disable log file rolling. To roll the file, specify a maximum file size in bytes. The size can be abbreviated with the suffixes 'k' for kilobytes, or 'm' for megabytes. For example, '10m' sets the log file to be rolled when it reaches a size of 10 megabytes.

or one of the conditions of

wrapper.logfile.rollmode is met

Controls the roll mode of the log file. Possible values include:

JVM - The log file will be rolled on Wrapper startup as with the WRAPPER mode. But it will also be rolled just before any restarted JVMs are launced. The log files will not have a maximum size and will continue to grow until the Wrapper or a JVM is restarted.

DATE - As each log entry is logged to a file, its timestamp is compared with a YYYYMMDD formatted token in the current log file. Whenever this date changes a new log file will be opened. This has the benefit of grouping all log entries for a given day in a specific file. A file will not be created on days which do not have any log output.

wrapper.logfile.maxfiles looks interesting and relevant too.

share|improve this answer
    
@lain do you think I should set like this wrapper.logfile.rollmode=YYYYMMDD –  user111196 Apr 2 '12 at 1:47
    
If you want your logs to roll daily yes. –  Iain Apr 2 '12 at 7:45
    
@lain yes I would try that first and see how it works –  user111196 Apr 2 '12 at 12:47
    
@lain I have put this wrapper.logfile.rollmode=YYYYMMDD in my config file but the day have change but I do not see a new log file either. –  user111196 Apr 2 '12 at 16:25

In Linux, if you have an open file handle on a file, moving or deleting the file will not affect the file handle. Thus, you cannot easily rotate the file without help from the process that writes to the file (it will simply keep writing to the deleted file). You need to investigate yajsw to see if it supports re-opening the log file. If it does, you can use logrotate, which is usually present on CentOS boxen to rotate the file.

share|improve this answer
    
how to check if a file have handle on a file? Any indication for that? –  user111196 Apr 2 '12 at 1:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.