| Detailed description |
I run a program using npgsql with the EventLog outputing.
When the the program is runing ,i want to look the log infomation,
so i open the log file with a text editor.
sometimes(not always) it lead to npgsql throw a Exception :
file 'xxxxxx.log' is opened by other process,and can not be access.(*)
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
System.IO.FileStream.Init(String path, FileMode mode, FileAccess access,
Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES
secAttrs,String msgPath, Boolean bFromProxy, Bool ean useLongPath)
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access , FileShare share, Int32
bufferSize,FileOptions options)
System.IO.StreamWriter.CreateFile(String path, Boolean append)
System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encod ing, Int32 bufferSize)
System.IO.StreamWriter..ctor(String path, Boolean append)
Npgsql.NpgsqlEventLog.LogMsg(NpgsqlConnection conn, String message, LogL evel msglevel)
Npgsql.NpgsqlEventLog.LogMethodEnter(NpgsqlConnection conn, LogLevel msg level, String ClassName,String MethodName)
Npgsql.ForwardsOnlyDataReader.GetProviderSpecificValue(Int32 ordinal)
Npgsql.ForwardsOnlyDataReader.GetValue(Int32 Index)
*)it's not the original message,the original message is not english in my environment,and i translated it english here.
I think the reason may be when Npgsql.NpgsqlEventLog.LogMsg() try to open the log file for writing just while the text editor is loading the same log file. |
|