comparison src/org/eclipse/jetty/server/NCSARequestLog.java @ 820:8e9db0bbf4f9

remove org.eclipse.jetty.util.log and upgrade slf4j
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 13 Sep 2016 23:13:06 -0600
parents 07c82fabc46b
children 2afcb04f56a4
comparison
equal deleted inserted replaced
819:17bd0b170ed6 820:8e9db0bbf4f9
31 import org.eclipse.jetty.http.PathMap; 31 import org.eclipse.jetty.http.PathMap;
32 import org.eclipse.jetty.util.DateCache; 32 import org.eclipse.jetty.util.DateCache;
33 import org.eclipse.jetty.util.RolloverFileOutputStream; 33 import org.eclipse.jetty.util.RolloverFileOutputStream;
34 import org.eclipse.jetty.util.StringUtil; 34 import org.eclipse.jetty.util.StringUtil;
35 import org.eclipse.jetty.util.component.AbstractLifeCycle; 35 import org.eclipse.jetty.util.component.AbstractLifeCycle;
36 import org.eclipse.jetty.util.log.Log; 36 import org.slf4j.Logger;
37 import org.eclipse.jetty.util.log.Logger; 37 import org.slf4j.LoggerFactory;
38 38
39 /** 39 /**
40 * This {@link RequestLog} implementation outputs logs in the pseudo-standard 40 * This {@link RequestLog} implementation outputs logs in the pseudo-standard
41 * NCSA common log format. Configuration options allow a choice between the 41 * NCSA common log format. Configuration options allow a choice between the
42 * standard Common Log Format (as used in the 3 log format) and the Combined Log 42 * standard Common Log Format (as used in the 3 log format) and the Combined Log
50 /* ------------------------------------------------------------ */ 50 /* ------------------------------------------------------------ */
51 /** 51 /**
52 */ 52 */
53 public class NCSARequestLog extends AbstractLifeCycle implements RequestLog 53 public class NCSARequestLog extends AbstractLifeCycle implements RequestLog
54 { 54 {
55 private static final Logger LOG = Log.getLogger(NCSARequestLog.class); 55 private static final Logger LOG = LoggerFactory.getLogger(NCSARequestLog.class);
56 private static ThreadLocal<StringBuilder> _buffers = new ThreadLocal<StringBuilder>() 56 private static ThreadLocal<StringBuilder> _buffers = new ThreadLocal<StringBuilder>()
57 { 57 {
58 @Override 58 @Override
59 protected StringBuilder initialValue() 59 protected StringBuilder initialValue()
60 { 60 {
585 String log = buf.toString(); 585 String log = buf.toString();
586 write(log); 586 write(log);
587 } 587 }
588 catch (IOException e) 588 catch (IOException e)
589 { 589 {
590 LOG.warn(e); 590 LOG.warn("",e);
591 } 591 }
592 } 592 }
593 593
594 /* ------------------------------------------------------------ */ 594 /* ------------------------------------------------------------ */
595 protected void write(String log) throws IOException 595 protected void write(String log) throws IOException
697 if (_writer != null) 697 if (_writer != null)
698 _writer.flush(); 698 _writer.flush();
699 } 699 }
700 catch (IOException e) 700 catch (IOException e)
701 { 701 {
702 LOG.ignore(e); 702 LOG.trace("",e);
703 } 703 }
704 if (_out != null && _closeOut) 704 if (_out != null && _closeOut)
705 try 705 try
706 { 706 {
707 _out.close(); 707 _out.close();
708 } 708 }
709 catch (IOException e) 709 catch (IOException e)
710 { 710 {
711 LOG.ignore(e); 711 LOG.trace("",e);
712 } 712 }
713 713
714 _out = null; 714 _out = null;
715 _fileOut = null; 715 _fileOut = null;
716 _closeOut = false; 716 _closeOut = false;