What do you log in your desktop applications to improve stability?

前端 未结 3 1826
囚心锁ツ
囚心锁ツ 2020-12-28 19:38

I\'ve started using SmartInspect in my Delphi applications because my users were running into bugs/problems I couldn\'t reproduce on my machine. When I have a general idea o

相关标签:
3条回答
  • 2020-12-28 20:16

    Current memory usage can be useful for long running processes to see if there are memory leaks (which could lead to an out of memory error some day).

    0 讨论(0)
  • 2020-12-28 20:21

    Here are some guidelines I tried to implement in my own OpenSource logging unit, but it's fairly generic, and as you state, it should be suitable for any logging package:

    • Make several levels (we use sets) of logging, to tune the logging information needed;
    • Log all exceptions, even the handled one with a try...except block - and add an exception classes list not worth logging (e.g. EConvertError) - e.g. our unit is able to log all exceptions via a global exception "hook" (no try..except to add in your code), and handle a list of exception classes to be ignored;
    • Log all "fatal" errors, like database connection issues, or wrong SQL syntax - should be done though "log all exceptions" previous item;
    • For such exceptions, log the stack trace to know about the calling context;
    • Be able to log all SQL statements, or database access;
    • Add a generic User Interface logging, to know which main functions of the software the User did trigger (e.g. for every toolbar button or menu items): it's very common that the user said 'I have this on my screen/report, but I didn't do anything'... and when you see the log, you will discover that the "anything" was done. ;)
    • Monitor the main methods of your application, and associated parameters;
    • Logging is an evolving feature: use those general rules above, then tune your logging from experiment, according to your debugging needs.
    0 讨论(0)
  • 2020-12-28 20:41

    For UI-driven applications here are the main things I instrument first:

    1. ActionManager or ActionList's events when an action executes (gives me a user clicked here then here then here list).

    2. Unhandled Exceptions with tracebacks using JCL debug go right in my main log, whereas if I was using MadExcept or EurekaLog, exceptions have their own log.

    3. Background thread starts, stops and significant history events

    4. Warnings, errors, API function failures, file access failures, handled (caught) exceptions.

    0 讨论(0)
提交回复
热议问题