changeset 854:359012f4e797

minor
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 20 Sep 2016 01:05:37 -0600
parents 3242aff51053
children fa6158f29c45
files src/org/eclipse/jetty/server/NCSARequestLog.java
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
diff -r 3242aff51053 -r 359012f4e797 src/org/eclipse/jetty/server/NCSARequestLog.java
--- a/src/org/eclipse/jetty/server/NCSARequestLog.java	Tue Sep 20 00:23:56 2016 -0600
+++ b/src/org/eclipse/jetty/server/NCSARequestLog.java	Tue Sep 20 01:05:37 2016 -0600
@@ -52,12 +52,10 @@
 public class NCSARequestLog extends AbstractLifeCycle implements RequestLog
 {
 	private static final Logger LOG = LoggerFactory.getLogger(NCSARequestLog.class);
-    private static final String __LINE_SEPARATOR=
-        System.getProperty("line.separator","\n");
 
 	private String _filename;
 	private boolean _extended;
-	public long sizeLimit = 1048576L;
+	public long retainTime = 1000L*60*60*24*31;  // 31 days
 	private boolean _closeOut;
 	private boolean _preferProxiedForAddress;
 	private String _logDateFormat = "dd/MMM/yyyy:HH:mm:ss Z";
@@ -455,7 +453,7 @@
 				}
 			}
 
-			buf.append(__LINE_SEPARATOR);
+			buf.append('\n');
 			
 			String log = buf.toString();
 			write(log);
@@ -530,10 +528,12 @@
 
 		if (_filename != null) {
 			File file = new File(_filename);
-			if( file.exists() && file.length() > sizeLimit ) {
+			if( file.exists() ) {
 				File old = new File(_filename+".old");
-				old.delete();
-				file.renameTo(old);
+				if( old.exists() && file.lastModified() - old.lastModified() > retainTime )
+					old.delete();
+				if( !old.exists() )
+					file.renameTo(old);
 			}
 			_out = new FileOutputStream(file,true);
 			_closeOut = true;