亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
91视频你懂的| 亚洲视频一区在线观看| 黑人精品欧美一区二区蜜桃 | 精品久久久久99| 理论电影国产精品| 精品国产三级a在线观看| 国产成人精品亚洲日本在线桃色 | 亚洲欧美影音先锋| 91亚洲国产成人精品一区二三| 亚洲一区视频在线观看视频| 欧美影院一区二区三区| 免费在线观看日韩欧美| 久久久久久免费网| 色系网站成人免费| 日韩国产精品91| 久久久久久久综合日本| 色天天综合久久久久综合片| 婷婷成人激情在线网| 久久综合国产精品| 91亚洲精品久久久蜜桃网站| 免费精品视频在线| 国产精品美日韩| 7777精品伊人久久久大香线蕉超级流畅| 日本不卡高清视频| 18涩涩午夜精品.www| 5月丁香婷婷综合| 成人午夜电影小说| 午夜成人在线视频| 中文字幕一区二区视频| 欧美日韩高清一区二区三区| 国产电影精品久久禁18| 亚洲国产综合在线| 国产午夜亚洲精品午夜鲁丝片| 欧美亚洲国产一卡| 国产精品一区免费在线观看| 亚洲一区二区在线免费看| 欧美成人一区二区三区| 91尤物视频在线观看| 精品无码三级在线观看视频| 亚洲人精品午夜| www日韩大片| 欧美日韩在线电影| 成人黄页毛片网站| 久国产精品韩国三级视频| 亚洲免费在线看| 国产午夜精品久久久久久久| 欧美久久一二区| 91久久精品网| 成人91在线观看| 国产精品影视在线观看| 免费在线成人网| 亚洲韩国精品一区| 亚洲女同ⅹxx女同tv| 国产日韩欧美a| 日韩欧美的一区| 欧美日韩情趣电影| 色综合亚洲欧洲| 成人黄色在线视频| 国产一区二区成人久久免费影院| 偷拍日韩校园综合在线| 一区二区三区免费观看| 国产精品久久久久久一区二区三区 | 欧美亚洲国产一区二区三区| 99久久精品费精品国产一区二区| 国产一区二区成人久久免费影院 | 亚洲欧美日韩一区二区三区在线观看| 26uuu色噜噜精品一区| 欧美一卡二卡三卡四卡| 欧美欧美午夜aⅴ在线观看| 91视频观看视频| 成人app在线观看| 成人精品国产福利| 成人一道本在线| 成人三级在线视频| 成人性生交大片免费| 成人网男人的天堂| 成人免费高清视频在线观看| 国产.欧美.日韩| 岛国av在线一区| www.日韩精品| 91在线你懂得| 91国偷自产一区二区开放时间 | 国产伦精品一区二区三区免费| 欧美一区二区三区电影| www.性欧美| 国产大陆精品国产| 国精产品一区一区三区mba视频| 久久精品国产澳门| 另类综合日韩欧美亚洲| 激情综合五月婷婷| 国产精品一区不卡| 成人午夜av影视| 色综合久久综合网97色综合| 91久久免费观看| 婷婷六月综合亚洲| 日韩一区欧美二区| 蜜臀精品久久久久久蜜臀 | 日韩久久久精品| 亚洲精品在线电影| 中文字幕av资源一区| 最新日韩av在线| 一区二区不卡在线视频 午夜欧美不卡在 | 精一区二区三区| 国产原创一区二区三区| 粉嫩蜜臀av国产精品网站| 91免费观看视频| 欧美日本一道本| 久久久综合视频| 亚洲日本青草视频在线怡红院 | 成人国产电影网| 在线一区二区视频| 欧美不卡在线视频| 国产亚洲污的网站| 亚洲影视在线播放| 国产在线观看一区二区| 97精品久久久久中文字幕| 欧美日韩国产bt| 国产日韩精品久久久| 亚洲一区二区三区四区五区中文| 91老师片黄在线观看| 欧美疯狂做受xxxx富婆| 国产日韩v精品一区二区| 洋洋av久久久久久久一区| 韩国av一区二区| 色婷婷精品大视频在线蜜桃视频| 精品国精品国产尤物美女| 亚洲特级片在线| 久久成人精品无人区| 91网站最新网址| 精品国产91乱码一区二区三区| 亚洲欧美自拍偷拍色图| 六月丁香综合在线视频| 色域天天综合网| 精品久久久三级丝袜| 依依成人精品视频| 国产盗摄一区二区| 欧美男男青年gay1069videost| 国产精品污网站| 日本亚洲天堂网| 色8久久人人97超碰香蕉987| www日韩大片| 日本视频在线一区| 一本大道久久a久久精二百| 久久奇米777| 亚洲6080在线| 色综合久久中文字幕综合网| 久久久无码精品亚洲日韩按摩| 日韩精品一级二级| 欧美在线观看视频一区二区| 中文av一区二区| 激情欧美日韩一区二区| 91麻豆精品国产91久久久久久| 国产精品妹子av| 成人免费高清视频| 欧美一三区三区四区免费在线看| 欧美精品一区二区蜜臀亚洲| 日本一区中文字幕| 在线观看91av| 天堂一区二区在线免费观看| 91国产成人在线| 一区二区三区四区国产精品| 成人sese在线| 日本一区免费视频| 国产精品白丝jk白祙喷水网站| 日韩欧美一卡二卡| 另类人妖一区二区av| 欧美mv日韩mv国产| 蜜臀av亚洲一区中文字幕| 制服丝袜日韩国产| 人人超碰91尤物精品国产| 欧美精品777| 蜜臀av性久久久久av蜜臀妖精| 欧美一区国产二区| 蜜臀av性久久久久蜜臀aⅴ流畅| 日韩欧美三级在线| 欧美日韩一区二区三区不卡| 亚洲国产精品欧美一二99| 欧美性猛交xxxx乱大交退制版| 亚洲美女精品一区| 欧美专区亚洲专区| 五月综合激情婷婷六月色窝| 欧美群妇大交群中文字幕| 琪琪一区二区三区| 欧美成人精品1314www| 国产一区不卡视频| 欧美精彩视频一区二区三区| 成人精品视频一区二区三区| 亚洲人吸女人奶水| 欧美日精品一区视频| 日韩在线一二三区| 日韩精品一区二| 国产成人无遮挡在线视频| 国产精品你懂的在线欣赏| 91网站视频在线观看| 同产精品九九九| 久久众筹精品私拍模特| 波多野结衣亚洲一区| 亚洲一区二区三区免费视频| 欧美一级一级性生活免费录像| 奇米四色…亚洲|