Collecting Runtime Logs

All EO products maintain an internal running log that may provide useful information to troubleshoot a problem. There are several ways to collect this log information. Note that the log information is encrypted.

Automatic Log Capture

Logs are automatically captured when an exception occurs in an EO internal thread. Since there is no user code in those threads, it is not possible for you to catch an exception in these threads using standard try..catch block, however it is possible for you to examine/log the exception information and/or collect internal logs when such an exception occurs. The library automatically performs the following steps When an exception occurs in an EO internal thread:

  1. Call EO.Base.Runtime.GetLogs to capture internal runtime logs;
  2. If EO.Base.Runtime.LogFileName is set, write the exception information and logs into LogFileName;
  3. Triggers EO.Base.Runtime.Exception event. The event argument contains both the exception information and the logs collected in step 1. You can handle this event to examine the exception and/or to write the logs into a file, for example:
    EO.Base.Runtime.Exception += Runtime_Exception;
    
    private static void Runtime_Exception(object sender, Base.ExceptionEventArgs e)
    {
        string log = e.ErrorException.ToString();
        log += Environment.NewLine;
        log += e.Logs;
        File.WriteAllText("log.txt", log);
    }
    Or simply use the following code:
    EO.Base.Runtime.Exception += Runtime_Exception;
    
    private static void Runtime_Exception(object sender, Base.ExceptionEventArgs e)
    {
        File.WriteAllText("log.txt", e.ToString());
    }
  4. If you do not handle this event, the library automatically displays an exception dialog with the exception information and the automatically captured logs. You can click "Copy To Clipboard" button in that dialog to copy the log information and email it to EO support.

    If you do not wish this dialog to be displayed, you must handle EO.Base.Runtime.Exception event.

Capture Log in User Thread

Exceptions occurred in user threads are not automatically handled. You must handle such exception and capture logs explicitly. For example:

try
{
    //Calling some code that may fail
    .....
}
catch (Exception ex)
{
    string log = ex.ToString();
    log += Environment.NewLine;
    log += EO.Base.Runtime.GetLogs();
    File.WriteAllText("log.txt", log);
}

Manually Collect Log with DebugTools

See here for details on how to collect and submit log data to Essential Objects using DebugTools.

Capture Detailed Diagnostic Logs

Use this option to capture detailed diagnostic logs. Capturing detailed diagnostic logs have a negative impact on performance, as such it should only be used as a test/troubleshooting measure, it should not be used in production code.

Follow these steps to capture detailed diagnostic logs:

  1. Call EO.Base.DiagnosticTools.StartDiagnosticLog as early as possible in your code. For example, for a Windows.Forms application, you can add this as the first line in your Program.Main method;
  2. Reproduce the problem in your application;
  3. Call EO.Base.DiagnosticTools.StopAndSaveDiagnosticLog to save the log. You can optionally pass a file name to save the log. In this case please send the file to us. If you do not pass a file name, the log will be automatically sent to our server and the function will return a record ID. Please send us the record ID so that we can locate the log in our system.