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

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

?? fileappender.cs

?? 詳細講述了數據庫編程
?? CS
?? 第 1 頁 / 共 3 頁
字號:
#region Copyright & License
//
// Copyright 2001-2006 The Apache Software Foundation
//
// Licensed 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.
//
#endregion

using System;
using System.IO;
using System.Text;

using log4net.Util;
using log4net.Layout;
using log4net.Core;

namespace log4net.Appender
{
	/// <summary>
	/// Appends logging events to a file.
	/// </summary>
	/// <remarks>
	/// <para>
	/// Logging events are sent to the file specified by
	/// the <see cref="File"/> property.
	/// </para>
	/// <para>
	/// The file can be opened in either append or overwrite mode 
	/// by specifying the <see cref="AppendToFile"/> property.
	/// If the file path is relative it is taken as relative from 
	/// the application base directory. The file encoding can be
	/// specified by setting the <see cref="Encoding"/> property.
	/// </para>
	/// <para>
	/// The layout's <see cref="ILayout.Header"/> and <see cref="ILayout.Footer"/>
	/// values will be written each time the file is opened and closed
	/// respectively. If the <see cref="AppendToFile"/> property is <see langword="true"/>
	/// then the file may contain multiple copies of the header and footer.
	/// </para>
	/// <para>
	/// This appender will first try to open the file for writing when <see cref="ActivateOptions"/>
	/// is called. This will typically be during configuration.
	/// If the file cannot be opened for writing the appender will attempt
	/// to open the file again each time a message is logged to the appender.
	/// If the file cannot be opened for writing when a message is logged then
	/// the message will be discarded by this appender.
	/// </para>
	/// <para>
	/// The <see cref="FileAppender"/> supports pluggable file locking models via
	/// the <see cref="LockingModel"/> property.
	/// The default behavior, implemented by <see cref="FileAppender.ExclusiveLock"/> 
	/// is to obtain an exclusive write lock on the file until this appender is closed.
	/// The alternative model, <see cref="FileAppender.MinimalLock"/>, only holds a
	/// write lock while the appender is writing a logging event.
	/// </para>
	/// </remarks>
	/// <author>Nicko Cadell</author>
	/// <author>Gert Driesen</author>
	/// <author>Rodrigo B. de Oliveira</author>
	/// <author>Douglas de la Torre</author>
	/// <author>Niall Daley</author>
	public class FileAppender : TextWriterAppender 
	{
		#region LockingStream Inner Class

		/// <summary>
		/// Write only <see cref="Stream"/> that uses the <see cref="LockingModelBase"/> 
		/// to manage access to an underlying resource.
		/// </summary>
		private sealed class LockingStream : Stream, IDisposable
		{
			public sealed class LockStateException : LogException
			{
				public LockStateException(string message): base(message)
				{
				}
			}

			private Stream m_realStream=null;
			private LockingModelBase m_lockingModel=null;
			private int m_readTotal=-1;
			private int m_lockLevel=0;

			public LockingStream(LockingModelBase locking) : base()
			{
				if (locking==null)
				{
					throw new ArgumentException("Locking model may not be null","locking");
				}
				m_lockingModel=locking;
			}

			#region Override Implementation of Stream

			// Methods
			public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
			{
				AssertLocked();
				IAsyncResult ret=m_realStream.BeginRead(buffer,offset,count,callback,state);
				m_readTotal=EndRead(ret);
				return ret;
			}

			/// <summary>
			/// True asynchronous writes are not supported, the implementation forces a synchronous write.
			/// </summary>
			public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
			{
				AssertLocked();
				IAsyncResult ret=m_realStream.BeginWrite(buffer,offset,count,callback,state);
				EndWrite(ret);
				return ret;
			}

			public override void Close() 
			{
				m_lockingModel.CloseFile();
			}

			public override int EndRead(IAsyncResult asyncResult) 
			{
				AssertLocked();
				return m_readTotal;
			}
			public override void EndWrite(IAsyncResult asyncResult) 
			{
				//No-op, it has already been handled
			}
			public override void Flush() 
			{
				AssertLocked();
				m_realStream.Flush();
			}
			public override int Read(byte[] buffer, int offset, int count) 
			{
				return m_realStream.Read(buffer,offset,count);
			}
			public override int ReadByte() 
			{
				return m_realStream.ReadByte();
			}
			public override long Seek(long offset, SeekOrigin origin) 
			{
				AssertLocked();
				return m_realStream.Seek(offset,origin);
			}
			public override void SetLength(long value) 
			{
				AssertLocked();
				m_realStream.SetLength(value);
			}
			void IDisposable.Dispose() 
			{
				this.Close();
			}
			public override void Write(byte[] buffer, int offset, int count) 
			{
				AssertLocked();
				m_realStream.Write(buffer,offset,count);
			}
			public override void WriteByte(byte value) 
			{
				AssertLocked();
				m_realStream.WriteByte(value);
			}

			// Properties
			public override bool CanRead 
			{ 
				get { return false; } 
			}
			public override bool CanSeek 
			{ 
				get 
				{
					AssertLocked();
					return m_realStream.CanSeek;
				} 
			}
			public override bool CanWrite 
			{ 
				get 
				{
					AssertLocked();
					return m_realStream.CanWrite;
				} 
			}
			public override long Length 
			{ 
				get 
				{
					AssertLocked();
					return m_realStream.Length;
				} 
			}
			public override long Position 
			{ 
				get 
				{
					AssertLocked();
					return m_realStream.Position;
				} 
				set 
				{
					AssertLocked();
					m_realStream.Position=value;
				} 
			}

			#endregion Override Implementation of Stream

			#region Locking Methods

			private void AssertLocked()
			{
				if (m_realStream == null)
				{
					throw new LockStateException("The file is not currently locked");
				}
			}

			public bool AcquireLock()
			{
				bool ret=false;
				lock(this)
				{
					if (m_lockLevel==0)
					{
						// If lock is already acquired, nop
						m_realStream=m_lockingModel.AcquireLock();
					}
					if (m_realStream!=null)
					{
						m_lockLevel++;
						ret=true;
					}
				}
				return ret;
			}

			public void ReleaseLock()
			{
				lock(this)
				{
					m_lockLevel--;
					if (m_lockLevel==0)
					{
						// If already unlocked, nop
						m_lockingModel.ReleaseLock();
						m_realStream=null;
					}
				}
			}

			#endregion Locking Methods
		}

		#endregion LockingStream Inner Class

		#region Locking Models

		/// <summary>
		/// Locking model base class
		/// </summary>
		/// <remarks>
		/// <para>
		/// Base class for the locking models available to the <see cref="FileAppender"/> derived loggers.
		/// </para>
		/// </remarks>
		public abstract class LockingModelBase
		{
			private FileAppender m_appender=null;

			/// <summary>
			/// Open the output file
			/// </summary>
			/// <param name="filename">The filename to use</param>
			/// <param name="append">Whether to append to the file, or overwrite</param>
			/// <param name="encoding">The encoding to use</param>
			/// <remarks>
			/// <para>
			/// Open the file specified and prepare for logging. 
			/// No writes will be made until <see cref="AcquireLock"/> is called.
			/// Must be called before any calls to <see cref="AcquireLock"/>,
			/// <see cref="ReleaseLock"/> and <see cref="CloseFile"/>.
			/// </para>
			/// </remarks>
			public abstract void OpenFile(string filename, bool append,Encoding encoding);

			/// <summary>
			/// Close the file
			/// </summary>
			/// <remarks>
			/// <para>
			/// Close the file. No further writes will be made.
			/// </para>
			/// </remarks>
			public abstract void CloseFile();

			/// <summary>
			/// Acquire the lock on the file
			/// </summary>
			/// <returns>A stream that is ready to be written to.</returns>
			/// <remarks>
			/// <para>
			/// Acquire the lock on the file in preparation for writing to it. 
			/// Return a stream pointing to the file. <see cref="ReleaseLock"/>
			/// must be called to release the lock on the output file.
			/// </para>
			/// </remarks>
			public abstract Stream AcquireLock();

			/// <summary>
			/// Release the lock on the file
			/// </summary>
			/// <remarks>
			/// <para>
			/// Release the lock on the file. No further writes will be made to the 
			/// stream until <see cref="AcquireLock"/> is called again.
			/// </para>
			/// </remarks>
			public abstract void ReleaseLock();

			/// <summary>
			/// Gets or sets the <see cref="FileAppender"/> for this LockingModel
			/// </summary>
			/// <value>
			/// The <see cref="FileAppender"/> for this LockingModel
			/// </value>
			/// <remarks>
			/// <para>
			/// The file appender this locking model is attached to and working on
			/// behalf of.
			/// </para>
			/// <para>
			/// The file appender is used to locate the security context and the error handler to use.
			/// </para>
			/// <para>
			/// The value of this property will be set before <see cref="OpenFile"/> is
			/// called.
			/// </para>
			/// </remarks>
			public FileAppender CurrentAppender
			{
				get { return m_appender; }
				set { m_appender = value; }
			}
		}

		/// <summary>
		/// Hold an exclusive lock on the output file
		/// </summary>
		/// <remarks>
		/// <para>
		/// Open the file once for writing and hold it open until <see cref="CloseFile"/> is called. 
		/// Maintains an exclusive lock on the file during this time.
		/// </para>
		/// </remarks>
		public class ExclusiveLock : LockingModelBase
		{
			private Stream m_stream = null;

			/// <summary>
			/// Open the file specified and prepare for logging.
			/// </summary>
			/// <param name="filename">The filename to use</param>
			/// <param name="append">Whether to append to the file, or overwrite</param>
			/// <param name="encoding">The encoding to use</param>
			/// <remarks>
			/// <para>
			/// Open the file specified and prepare for logging. 
			/// No writes will be made until <see cref="AcquireLock"/> is called.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品一区二区三区视频| 无码av免费一区二区三区试看| 欧美一区二区三区在线视频| 在线视频观看一区| 99精品热视频| caoporn国产一区二区| 粉嫩高潮美女一区二区三区| 国产乱子伦视频一区二区三区 | 五月激情六月综合| 亚洲第一福利一区| 亚洲动漫第一页| 日韩激情一二三区| 九一九一国产精品| 国产激情视频一区二区在线观看| 国产精品一区二区无线| 丁香一区二区三区| 91美女在线观看| 在线亚洲人成电影网站色www| 欧美在线免费播放| 欧美日韩精品一区二区| 欧美一区二区久久久| 精品国产一区a| 欧美极品少妇xxxxⅹ高跟鞋 | 成人av网站大全| 91日韩一区二区三区| 欧美亚洲一区二区三区四区| 欧美三级日韩三级国产三级| 日韩一区二区三区电影在线观看 | 国产免费久久精品| 亚洲欧美另类在线| 丝袜亚洲另类欧美| 国产自产视频一区二区三区| av网站一区二区三区| 91高清视频在线| 日韩欧美一级片| 中文久久乱码一区二区| 一区二区免费在线| 美女视频黄频大全不卡视频在线播放| 国产精品99久久久久| 91久久一区二区| 欧美成人vps| 亚洲男人的天堂一区二区| 日本少妇一区二区| 成人高清在线视频| 欧美一区三区二区| 亚洲色图清纯唯美| 美女视频一区在线观看| 成人av在线资源| 欧美在线一区二区| 欧美综合天天夜夜久久| 欧美高清视频不卡网| 久久青草国产手机看片福利盒子| 国产精品久久久久久亚洲伦| 亚洲一区中文在线| 水野朝阳av一区二区三区| 麻豆国产精品一区二区三区 | 国产精品午夜久久| 伊人一区二区三区| 久久精品免费观看| 成人国产精品免费观看动漫| 日本道色综合久久| 日韩精品一区二区三区视频播放 | 久久久国产综合精品女国产盗摄| 亚洲国产高清在线观看视频| 蜜臀久久99精品久久久久宅男| 国产精品羞羞答答xxdd| 色久综合一二码| 在线播放欧美女士性生活| www国产成人| 91精品国产综合久久精品图片 | 国产aⅴ综合色| 91福利资源站| 亚洲精品一线二线三线| 亚洲精品中文在线影院| 激情久久五月天| 欧美无人高清视频在线观看| 久久久久亚洲蜜桃| 亚洲国产cao| 丝瓜av网站精品一区二区| 国产乱码字幕精品高清av| 色猫猫国产区一区二在线视频| 日韩免费观看高清完整版 | 欧日韩精品视频| 国产婷婷精品av在线| 午夜视频在线观看一区二区三区| 国产精品自拍一区| 色哟哟国产精品| 国产亚洲精品中文字幕| 国产精品99久久久久久久女警| 欧美午夜寂寞影院| 亚洲婷婷国产精品电影人久久| 久久er99精品| 在线电影国产精品| 久久新电视剧免费观看| 亚洲国产精品欧美一二99| 国产91在线观看| 日韩精品一区二区三区蜜臀| 亚洲午夜国产一区99re久久| 粉嫩一区二区三区在线看| 欧美videos中文字幕| 午夜成人免费电影| 欧美色国产精品| 亚洲一区二区欧美| 成人午夜精品一区二区三区| 久久综合国产精品| 毛片不卡一区二区| 91麻豆精品国产自产在线观看一区 | 国产成人综合精品三级| 91精品国产综合久久精品麻豆 | 1024成人网| 高清国产午夜精品久久久久久| 欧美va亚洲va在线观看蝴蝶网| 日本视频一区二区三区| 色综合久久综合中文综合网| 中文字幕亚洲不卡| 99精品在线免费| 亚洲色图另类专区| 粉嫩av一区二区三区在线播放 | 欧美日韩电影在线播放| 国产精品午夜免费| 成人va在线观看| 国产精品五月天| www.欧美日韩| 成人欧美一区二区三区视频网页 | 国产精品久久二区二区| 丰满白嫩尤物一区二区| 欧美精品一区二区三区高清aⅴ| 韩国v欧美v亚洲v日本v| 久久丝袜美腿综合| 国产盗摄一区二区| 国产精品麻豆久久久| 丁香啪啪综合成人亚洲小说| 久久综合国产精品| 国内不卡的二区三区中文字幕| 欧洲av一区二区嗯嗯嗯啊| 亚洲成人av中文| 制服丝袜在线91| 激情成人综合网| 国产亚洲自拍一区| av成人老司机| 亚洲成人www| 欧美电影影音先锋| 日本美女视频一区二区| 日韩一区二区免费视频| 黑人巨大精品欧美一区| 国产欧美日韩精品a在线观看| 国产麻豆精品一区二区| 日韩视频免费直播| 国产自产2019最新不卡| 亚洲夂夂婷婷色拍ww47| 国产日韩精品一区二区三区在线| 国产成人鲁色资源国产91色综| 国产片一区二区三区| 国产成人精品www牛牛影视| 国产精品人成在线观看免费| 一本到不卡免费一区二区| 水野朝阳av一区二区三区| 久久色.com| 色综合久久九月婷婷色综合| 亚洲成a人v欧美综合天堂下载| 日韩精品中文字幕一区二区三区| 蜜桃久久av一区| 国产色一区二区| 欧美日韩精品一区视频| 久久精品二区亚洲w码| 欧美国产日韩精品免费观看| 欧美色偷偷大香| 美洲天堂一区二卡三卡四卡视频| 亚洲国产精品v| 5566中文字幕一区二区电影| 国产成人三级在线观看| 自拍偷拍欧美激情| 91精品国产手机| 97国产一区二区| 日韩成人精品在线| 中文字幕一区二区三区乱码在线 | 亚洲日本青草视频在线怡红院| 欧美精品在线视频| 成人性生交大片免费看在线播放| 亚洲成人免费在线| 国产目拍亚洲精品99久久精品| 国产91丝袜在线18| 亚洲黄色av一区| 久久精品一区二区三区不卡牛牛| 欧美亚洲国产一卡| 粉嫩aⅴ一区二区三区四区五区| 午夜免费久久看| 亚洲欧美日韩综合aⅴ视频| 欧美一区二区黄色| 色94色欧美sute亚洲线路二| 国内精品视频666| 亚洲图片一区二区| 中文字幕欧美激情一区| 日韩欧美视频在线| 欧洲在线/亚洲| 菠萝蜜视频在线观看一区| 日韩av网站在线观看| 亚洲另类色综合网站| 国产欧美日韩另类视频免费观看| 日韩欧美亚洲一区二区|