0 votes
by (750 points)

In my case I get time out issue but my console application runs through scheduler at various time set.

So I don't know when a time out issue will occur but the error should be logged in the log file.

for this I use the following code :-

objImapClient.LogWriter = new Rebex.FileLogWriter(@PathForRebexLog, Rebex.LogLevel.Error);

now the problem with the above code is that it will create a log file every time my application exe is run and the new log will overwrite the old log file so if I have an error logged in my log file then the above code will overite the error log file with a new one and in the new instance there might be no error of timeout and the error will not be caught. so to this case please tell me what to do can we append the info in the log file and not overite or can we use Rebex.LogLevel.Error?? please answer my querry as soon as possible.

1 Answer

0 votes
by (58.9k points)

The Rebex.FileLogWriter does not delete the content of old logs, it actually automatically appends the new log to the end of the file (if a file is existing already).

If I run this code, I end up having a log file with 10 connection attempts, so for me it works correctly:

for (int i = 0; i < 10; i++)
{
    Imap client = new Imap();
    client.LogWriter = new Rebex.FileLogWriter(@"C:\MyLogFiles\rebex-imap-log.txt");
    client.Connect("imap.gmail.com", SslMode.Implicit);
    client.Disconnect();
}

However, please note that if you have problems with Rebex components that you want to solve/debug, it is better to use Rebex.LogLevel.Debug instead of Rebex.LogLevel.Error verbosity. The error verbose level only logs the stacktrace of the error that occured, whereas the Rebex.LogLevel.Debug logs more communication between the server and client which is usually crucial to find the cause of the error itself). The Rebex.LogLevel.Debug is also the default value.

...