Any way your compont write log in separete thread.
It write not all message in other thread and only such as
DEBUG [v] 11 авг 2006 14:18:15.187 : OnReceive - socket not connected - closing
DEBUG [cn] 11 авг 2006 14:21:43.953 : Close() called when open
DEBUG [v] 11 авг 2006 14:22:07.781 : OnReceive - size == 0 - closing
DEBUG [cn] 11 авг 2006 14:23:50.156 : Close() called when open
I have write own appender in order to add message from your component to my own log. This is source code:
internal class LogAppender : Appender
{
private FTPTransport _transport;
public LogAppender(FTPTransport transport)
{
_transport = transport;
}
#region Appender Members
public void Log(Exception t)
{
if (_transport != null)
_transport.Log(LogLevel.Error, "", t);
}
void Appender.Log(string msg)
{
if (_transport != null)
{
string level = string.Empty;
if (msg.IndexOf(" ") != -1)
level = msg.Substring(0, msg.IndexOf(" "));
string message = string.Empty;
int pos = msg.IndexOf(" : ", 0);
if (pos != -1)
{
pos += 3;
if (pos < msg.Length)
message = msg.Substring(pos);
}
//string message = msg;
LogLevel logLevel;
switch (level)
{
case "DEBUG":
logLevel = LogLevel.Debug;
break;
case "ERROR":
case "FATAL":
logLevel = LogLevel.Error;
break;
case "INFO":
logLevel = LogLevel.Info;
break;
case "WARN":
logLevel = LogLevel.Warn;
break;
default:
logLevel = LogLevel.Debug;
break;
}
if (_transport.ThreadId == Thread.CurrentThread.ManagedThreadId)
{
_transport.Log(logLevel, message);
}
else
{
// If excecute in other thread
_transport.AddLogItem(logLevel, message);
}
}
}