亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? writerappender.java

?? apache的log4j源碼
?? JAVA
字號:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements.  See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License.  You may obtain a copy of the License at *  *      http://www.apache.org/licenses/LICENSE-2.0 *  * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package org.apache.log4j;import java.io.IOException;import java.io.Writer;import java.io.OutputStream;import java.io.OutputStreamWriter;import org.apache.log4j.spi.ErrorHandler;import org.apache.log4j.spi.LoggingEvent;import org.apache.log4j.helpers.QuietWriter;import org.apache.log4j.helpers.LogLog;// Contibutors: Jens Uwe Pipka <jens.pipka@gmx.de>//              Ben Sandee/**   WriterAppender appends log events to a {@link java.io.Writer} or an   {@link java.io.OutputStream} depending on the user's choice.   @author Ceki G&uuml;lc&uuml;   @since 1.1 */public class WriterAppender extends AppenderSkeleton {  /**     Immediate flush means that the underlying writer or output stream     will be flushed at the end of each append operation. Immediate     flush is slower but ensures that each append request is actually     written. If <code>immediateFlush</code> is set to     <code>false</code>, then there is a good chance that the last few     logs events are not actually written to persistent media if and     when the application crashes.     <p>The <code>immediateFlush</code> variable is set to     <code>true</code> by default.  */  protected boolean immediateFlush = true;  /**     The encoding to use when writing.  <p>The     <code>encoding</code> variable is set to <code>null</null> by     default which results in the utilization of the system's default     encoding.  */  protected String encoding;  /**     This is the {@link QuietWriter quietWriter} where we will write     to.  */  protected QuietWriter qw;  /**     This default constructor does nothing.  */  public  WriterAppender() {  }  /**     Instantiate a WriterAppender and set the output destination to a     new {@link OutputStreamWriter} initialized with <code>os</code>     as its {@link OutputStream}.  */  public  WriterAppender(Layout layout, OutputStream os) {    this(layout, new OutputStreamWriter(os));  }  /**     Instantiate a WriterAppender and set the output destination to     <code>writer</code>.     <p>The <code>writer</code> must have been previously opened by     the user.  */  public  WriterAppender(Layout layout, Writer writer) {    this.layout = layout;    this.setWriter(writer);  }  /**     If the <b>ImmediateFlush</b> option is set to     <code>true</code>, the appender will flush at the end of each     write. This is the default behavior. If the option is set to     <code>false</code>, then the underlying stream can defer writing     to physical medium to a later time.     <p>Avoiding the flush operation at the end of each append results in     a performance gain of 10 to 20 percent. However, there is safety     tradeoff involved in skipping flushing. Indeed, when flushing is     skipped, then it is likely that the last few log events will not     be recorded on disk when the application exits. This is a high     price to pay even for a 20% performance gain.   */  public  void setImmediateFlush(boolean value) {    immediateFlush = value;  }  /**     Returns value of the <b>ImmediateFlush</b> option.   */  public  boolean getImmediateFlush() {    return immediateFlush;  }  /**     Does nothing.  */  public  void activateOptions() {  }  /**     This method is called by the {@link AppenderSkeleton#doAppend}     method.     <p>If the output stream exists and is writable then write a log     statement to the output stream. Otherwise, write a single warning     message to <code>System.err</code>.     <p>The format of the output will depend on this appender's     layout.  */  public  void append(LoggingEvent event) {    // Reminder: the nesting of calls is:    //    //    doAppend()    //      - check threshold    //      - filter    //      - append();    //        - checkEntryConditions();    //        - subAppend();    if(!checkEntryConditions()) {      return;    }    subAppend(event);   }  /**     This method determines if there is a sense in attempting to append.     <p>It checks whether there is a set output target and also if     there is a set layout. If these checks fail, then the boolean     value <code>false</code> is returned. */  protected  boolean checkEntryConditions() {    if(this.closed) {      LogLog.warn("Not allowed to write to a closed appender.");      return false;    }    if(this.qw == null) {      errorHandler.error("No output stream or file set for the appender named ["+			name+"].");      return false;    }    if(this.layout == null) {      errorHandler.error("No layout set for the appender named ["+ name+"].");      return false;    }    return true;  }  /**     Close this appender instance. The underlying stream or writer is     also closed.     <p>Closed appenders cannot be reused.     @see #setWriter     @since 0.8.4 */  public  synchronized  void close() {    if(this.closed)      return;    this.closed = true;    writeFooter();    reset();  }  /**   * Close the underlying {@link java.io.Writer}.   * */  protected void closeWriter() {    if(qw != null) {      try {	qw.close();      } catch(IOException e) {	// There is do need to invoke an error handler at this late	// stage.	LogLog.error("Could not close " + qw, e);      }    }  }  /**     Returns an OutputStreamWriter when passed an OutputStream.  The     encoding used will depend on the value of the     <code>encoding</code> property.  If the encoding value is     specified incorrectly the writer will be opened using the default     system encoding (an error message will be printed to the loglog.  */  protected  OutputStreamWriter createWriter(OutputStream os) {    OutputStreamWriter retval = null;    String enc = getEncoding();    if(enc != null) {      try {	retval = new OutputStreamWriter(os, enc);      } catch(IOException e) {	LogLog.warn("Error initializing output writer.");	LogLog.warn("Unsupported encoding?");      }    }    if(retval == null) {      retval = new OutputStreamWriter(os);    }    return retval;  }  public String getEncoding() {    return encoding;  }  public void setEncoding(String value) {    encoding = value;  }  /**     Set the {@link ErrorHandler} for this WriterAppender and also the     underlying {@link QuietWriter} if any. */  public synchronized void setErrorHandler(ErrorHandler eh) {    if(eh == null) {      LogLog.warn("You have tried to set a null error-handler.");    } else {      this.errorHandler = eh;      if(this.qw != null) {	this.qw.setErrorHandler(eh);      }    }  }  /**    <p>Sets the Writer where the log output will go. The    specified Writer must be opened by the user and be    writable.    <p>The <code>java.io.Writer</code> will be closed when the    appender instance is closed.    <p><b>WARNING:</b> Logging to an unopened Writer will fail.    <p>    @param writer An already opened Writer.  */  public synchronized void setWriter(Writer writer) {    reset();    this.qw = new QuietWriter(writer, errorHandler);    //this.tp = new TracerPrintWriter(qw);    writeHeader();  }  /**     Actual writing occurs here.     <p>Most subclasses of <code>WriterAppender</code> will need to     override this method.     @since 0.9.0 */  protected  void subAppend(LoggingEvent event) {    this.qw.write(this.layout.format(event));    if(layout.ignoresThrowable()) {      String[] s = event.getThrowableStrRep();      if (s != null) {	int len = s.length;	for(int i = 0; i < len; i++) {	  this.qw.write(s[i]);	  this.qw.write(Layout.LINE_SEP);	}      }    }    if(this.immediateFlush) {      this.qw.flush();    }  }  /**     The WriterAppender requires a layout. Hence, this method returns     <code>true</code>.  */  public  boolean requiresLayout() {    return true;  }  /**     Clear internal references to the writer and other variables.     Subclasses can override this method for an alternate closing     behavior.  */  protected  void reset() {    closeWriter();    this.qw = null;    //this.tp = null;  }  /**     Write a footer as produced by the embedded layout's {@link     Layout#getFooter} method.  */  protected  void writeFooter() {    if(layout != null) {      String f = layout.getFooter();      if(f != null && this.qw != null) {	this.qw.write(f);	this.qw.flush();      }    }  }  /**     Write a header as produced by the embedded layout's {@link     Layout#getHeader} method.  */  protected  void writeHeader() {    if(layout != null) {      String h = layout.getHeader();      if(h != null && this.qw != null)	this.qw.write(h);    }  }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99精品视频在线免费观看| 色综合色狠狠天天综合色| 日韩福利电影在线| 五月综合激情日本mⅴ| 亚洲国产中文字幕在线视频综合| 悠悠色在线精品| 亚洲一区在线免费观看| 亚洲一区二区三区在线播放| 亚洲电影在线播放| 日韩综合在线视频| 麻豆国产欧美日韩综合精品二区| 久久成人av少妇免费| 国产乱人伦偷精品视频免下载| 黄色精品一二区| 丁香婷婷深情五月亚洲| 成人动漫一区二区三区| 色综合欧美在线视频区| 欧美日韩国产a| 在线不卡欧美精品一区二区三区| 4hu四虎永久在线影院成人| 欧美一区二区人人喊爽| www亚洲一区| 国产精品欧美一区喷水| 中文字幕亚洲综合久久菠萝蜜| 亚洲免费观看在线观看| 亚洲国产精品久久久久婷婷884| 日本美女视频一区二区| 国内国产精品久久| 91亚洲男人天堂| 欧美狂野另类xxxxoooo| 精品国产免费人成在线观看| 1区2区3区精品视频| 丝袜a∨在线一区二区三区不卡| 日日夜夜精品免费视频| 国产一区二区三区不卡在线观看 | 国产精品久久免费看| ...xxx性欧美| 午夜精品久久久久久久久| 久久99久久久久| 成人动漫av在线| 欧美一区二区三区系列电影| 国产欧美一区视频| 亚洲一级电影视频| 精品一区二区精品| 91在线一区二区| 337p亚洲精品色噜噜噜| 国产日本亚洲高清| 五月天久久比比资源色| 国产麻豆午夜三级精品| 在线观看网站黄不卡| 久久综合一区二区| 一区二区三区四区中文字幕| 国产精品综合二区| 欧美性猛片xxxx免费看久爱| 久久久美女艺术照精彩视频福利播放| 亚洲婷婷在线视频| 国产在线一区观看| 欧美日韩三级一区二区| 中文字幕一区二区三区四区 | 欧美一区二视频| 中文字幕av资源一区| 日本欧美加勒比视频| 色综合久久综合网欧美综合网 | 一区二区三区电影在线播| 另类中文字幕网| 欧美又粗又大又爽| 中文乱码免费一区二区| 狠狠色综合播放一区二区| 精品视频在线免费观看| 中文字幕在线不卡一区二区三区| 精品一区二区在线视频| 欧美日本一区二区三区四区| 亚洲视频一区在线| 国产电影一区在线| 日韩午夜在线影院| 午夜天堂影视香蕉久久| 欧美性猛片aaaaaaa做受| 国产精品成人一区二区艾草| 国产一区二区免费在线| 日韩三级高清在线| 亚洲国产一区二区三区| 不卡区在线中文字幕| 国产午夜精品久久久久久久 | 岛国av在线一区| 精品福利在线导航| 日韩电影免费一区| 欧美网站一区二区| 夜夜精品浪潮av一区二区三区| 不卡电影一区二区三区| 亚洲国产精品二十页| 国产成人亚洲精品青草天美 | 日本人妖一区二区| 欧美日韩午夜在线| 樱花影视一区二区| 91激情五月电影| 亚洲精品国产第一综合99久久| 北条麻妃国产九九精品视频| 日本一区二区三区高清不卡| 国产乱码精品一品二品| 26uuu色噜噜精品一区二区| 免费高清不卡av| 日韩欧美另类在线| 蜜臀91精品一区二区三区| 欧美一级日韩一级| 看片的网站亚洲| 欧美成人女星排行榜| 国产在线视视频有精品| 久久免费精品国产久精品久久久久| 激情图区综合网| 国产婷婷色一区二区三区| 国产激情一区二区三区桃花岛亚洲| 久久精品欧美一区二区三区麻豆| 国产成人精品一区二区三区四区| 久久久精品综合| yourporn久久国产精品| 亚洲免费电影在线| 欧美色区777第一页| 日韩中文字幕区一区有砖一区| 欧美tk—视频vk| 国产精品一级二级三级| 国产精品第四页| 欧美性大战久久| 免费精品视频最新在线| 久久精品视频一区| 91天堂素人约啪| 日韩高清欧美激情| 久久婷婷国产综合国色天香| www.视频一区| 午夜成人免费电影| 国产亚洲综合在线| 色综合天天做天天爱| 天天色综合成人网| 欧美精品一区二| 色狠狠桃花综合| 免费精品视频最新在线| 国产精品网站在线播放| 欧美日韩一区二区电影| 激情综合亚洲精品| 中文字幕中文字幕一区二区| 欧美日韩午夜精品| 国产成人av福利| 亚洲一区欧美一区| 亚洲精品一区二区三区四区高清| 91麻豆免费视频| 老司机午夜精品| 亚洲婷婷国产精品电影人久久| 3d动漫精品啪啪一区二区竹菊| 国产成人综合亚洲网站| 亚洲国产毛片aaaaa无费看 | 综合久久给合久久狠狠狠97色 | 欧美成人高清电影在线| 99在线精品一区二区三区| 天堂成人免费av电影一区| 国产精品青草久久| 91精品国产一区二区三区香蕉| 成人午夜伦理影院| 视频一区国产视频| 国产精品亲子乱子伦xxxx裸| 欧美一区二区不卡视频| 91在线丨porny丨国产| 久久福利视频一区二区| 亚洲欧美日韩一区二区 | 国产拍欧美日韩视频二区| 在线视频一区二区免费| 国产一区二区三区免费在线观看| 亚洲第一在线综合网站| 国产日韩精品久久久| 91麻豆精品国产综合久久久久久 | 国产精品视频yy9299一区| 欧美久久久久久久久中文字幕| av一区二区久久| 九九九久久久精品| 婷婷久久综合九色综合伊人色| 亚洲欧洲av在线| 2023国产一二三区日本精品2022| 欧美三级午夜理伦三级中视频| 99精品国产热久久91蜜凸| 狠狠色伊人亚洲综合成人| 亚洲综合色网站| 亚洲欧美在线视频| 久久久激情视频| 欧美成人aa大片| 4438亚洲最大| 欧美精品少妇一区二区三区| 在线看不卡av| 一本大道久久a久久综合| 粉嫩高潮美女一区二区三区| 国产一区二区91| 精品一区二区综合| 日本系列欧美系列| 亚洲激情校园春色| 亚洲欧美国产毛片在线| 国产精品第五页| 亚洲国产经典视频| 国产午夜精品一区二区三区四区 | 毛片av中文字幕一区二区| 亚洲不卡av一区二区三区| 一区二区激情小说| 亚洲一区电影777| 亚洲激情在线播放|