Only rotate log files if the existing file is not empty.
This commit is contained in:
		
							parent
							
								
									2b5057e136
								
							
						
					
					
						commit
						3472ea06c1
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		|  | @ -202,13 +202,14 @@ public final class Logger { | |||
|      *  start a new one. | ||||
|      */ | ||||
|     private void rotateLogFile () throws IOException { | ||||
| 	// if the logger is not file based do nothing | ||||
| 	// if the logger is not file based do nothing. | ||||
| 	if (logfile == null) | ||||
| 	    return; | ||||
| 	if (writer != null) try { | ||||
| 	    writer.close(); | ||||
| 	} catch (Exception ignore) {} | ||||
| 	if (logfile.exists()) { | ||||
| 	// only backup/rotate if the log file is not empty, | ||||
| 	if (logfile.exists() && logfile.length() > 0) { | ||||
| 	    String today = aformat.format(new Date()); | ||||
| 	    int ct=0; | ||||
| 	    File archive = null; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue