The CodeSite Logging System gives developers deeper insight into how their code is executing, enabling them to locate problems more quickly and monitor how well their code is performing. Developers instrument their code using CodeSite loggers which send CodeSite messages to a live display or log file during program execution. All kinds of information can be encoded in a CodeSite message, and the CodeSite Live Viewer and File Viewer are specially designed tools for analyzing CodeSite messages. CodeSite is not only effective during development and testing; in production environments, CodeSite provides valuable information to support staff and developers.
Note: EurekaLog itself can stream to CodeSite-compatible format, though these features are very limited. We don't recommend to use EurekaLog's logging capabilities when you have access to a proper logging framework.
CodeSite to EurekaLogIf you are using CodeSite in your application - it may be useful to get CodeSite output as part of your EurekaLog's crash reports, so you will get a better understanding of execution flow of your application before crash. You can attach the log file from CodeSite with the following code example:
Important Note: example below will add a new file with log output from CodeSite. The new file will be added inside EurekaLog's bug report that is being send to developers. In other words, you have to set up sending to receive this file. The local EurekaLog's report do not store any additional files. If you wish to capture .elp file locally for testing purposes - see this example.
uses ESysInfo, // for GetFolderTemp // Initialize CodeSite to save log to file
// Ask EurekaLog to add more files to .elp reports
When you receive crash report from EurekaLog - the CodeSite log will be shown as file attach:
CodeSite log file inside EurekaLog's crash report Double-click log file to view in CodeSite Viewer tool
EurekaLog to CodeSiteAlternatively, you may want to set up a reverse integration. E.g. you may want to have EurekaLog's crash information inside your CodeSite log files. Use example below:
uses CodeSiteLogging, // for CodeSite classes and routines EEvents; // for RegisterEventExceptionNotify // Tell EurekaLog to log crash info with CodeSite (AExceptionInfo.ExceptionObject <> nil) and // For example, if the exception object was already deleted: // // try // raise Exception.Create('Inner Exception'); // - will be deleted // except // on E: Exception do // raise Exception.Create('Outer Exception'); // end; // // See also. // That is why we check for NIL in the example above. // For this reason we highly recommend to use properties of AExceptionInfo when possible, // Such as .ExceptionClass and .ExceptionMessage CodeSite.SendException( AExceptionInfo.ExceptionClass, Exception(AExceptionInfo.ExceptionObject)) AExceptionInfo.ExceptionMessage]); // Tell EurekaLog to log crash info with CodeSite
Important Note: events from examples above will be called only for exceptions. If you want to call your code also for leaks - see this question. However, leaks checks run at app's shutdown. It means your application is basically DEAD at this point. For example, many functions from the SysUtils unit will not function correctly, as SysUtils's globals were already released. This includes some very basic stuff like the Format function. And your code definitely should not throw any exceptions at this point.
See also:
|