Mercurial Hosting > luan
diff src/org/eclipse/jetty/server/NCSARequestLog.java @ 854:359012f4e797
minor
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 20 Sep 2016 01:05:37 -0600 |
parents | 3242aff51053 |
children | fa6158f29c45 |
line wrap: on
line diff
--- 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;