Using Delphi 7, I wonder if there is a free component which will collect diagnostic information as my application runs at a remote site and will help me to debug error reports.
Maybe it records each menu item selected, control clicked, text input, etc? Maybe it just dumps the stack on a crash. Maybe it does something else ...
I don't mind adding code (e.g at the start and end of each procedure), as that might generate more useful info than a fully automatic system.
I am not sure if the solution ought to "phone home" or if it is enough to produce a text file which can be emailed to me.
Any suggestions?
with the crash debuging have a look at MadExcept
http://www.madshi.net/madExceptDescription.htm
madExcept was built to help you locating crashes in your software. Whenever there's a crash/exception in your program, madExcept will automatically catch it, analyze it, collect lots of useful information, and give the end user the possibility to send you a full bug report.
free for non-commercial usage, inexpensive for commercial usage
or JclDebug from the JEDI Code Library
http://www.delphi-jedi.org/
A Blog Posting about it can be found here
http://www.gnegg.ch/2002/12/jcldebug/
EDIT: This seems to be a very good example on how to use JCLDebug
http://robstechcorner.blogspot.com/2009/04/finding-hard-to-reproduce-errors.html
I use EurekaLog http://www.eurekalog.com
It does the call stack, memory contents, other apps running, a good description of the machine, OS, patches, etc.., It can (with user permission, and if configured to to so) take a screenshot, ask the user for input (what were you doing when it crashed?), etc.. It can send the dump via e-mail, post to http, post directly to bug trackers like Mantis and FogBugz, or just leave it on the system. It's great, and well supported.
Also, here's a link to a similar question
Compare Delphi Exception Handlers
Have you looked at the open-source JclDebug from Project Jedi? Here's a nice succinct write-up on JclDebug.
Imagine you could get a detailed
error-report containing a full
callstack of where the error occured
combined with information about file
and line-number. This report could be
generated directly on the users
computer and be sent to you via email
or directly via the internet, using a
custom procedure - even directly
creating entries in the
bugtracking-tool you are using.
This and more is made possible by the
Project JEDI - more accuratly, the
JCL-Subproject with its
JclDebug-Framework. When you have
completed the installation of the
package, a new Menu Option called
"Inser JCL Debug Data" will be added
to the Project-Menu of your
Delphi-IDE.
There is a great delphi porting of the most known opensource logging framework written in java, Log4J: it is called Log4Delphi.
http://log4delphi.sourceforge.net
I downloaded it, extended and used with my projects with success.
Best features: opensource, Apache license, very well documented, simple to extend it, power design: with the concept of appender, you could build up your custom appender and use it to send logging data from remote customer computer to your head quarter using UDP protocol.
Try it, and let me know :-)
PS: the project seems to be discontinued, but it is mature and I'd used it without memory overload and cpu overhead problems.
The log4Delphi project has been dormant for 4 years but I have been granted access to update the dormant Log4Delphi project and I have rolled up 4 years of bugfixes and patches into the latest 0.8 release available on Source-forge. I use this library in production and have found it to very stable and reliable and easy to use.
Log4Delphi Downloads Page
Related
I have an old software that I believe was done in Delphi and uses .rep files for reports.
Is there any way to figure out what report builder was used? Opening the file in HEX or Text only doesn't really tell a lot, it shows quite some text that is used within the report though.
Thanks
Patrick
Candidates:
A Visual dBase file, it that case it should be mainly ASCII text, but your question seems to rule that out.
A (SAP) Business Objects Report file
An Act! (CRM software) report file
A Grand Theft Auto San Andreas game replay file.
Since you say it is 'used for report', BO is your best bet. It was acquired by SAP in 2007, before that it was standalone software produced by Business Objects AG.
So you probably need a copy of that to open the file.
Maybe there are other ways to inspect/use the file, other people have faced the same problem
Quite simply without access to the source code, you have no way of knowing. None of the major third party Delphi reporting components (Quick Reports, Rave, Crystal, Report Builder, Fast Reports/Free Report) I'm aware of use *.rep as their default file extension. That isn't to say that the program authors didn't use one of these components, but opted to replace the tool's default extension with *.rep. There's also the possibility that the program's authors used their own custom and proprietary reporting system.
You could potentially take one of these .Rep files and try and load them into each Delphi reporting tool and see what the results are but I think your chances of success are exceedingly low.
Users have been reporting problems/crashes/bugs that I can't reproduce on my machine. I'm finding these problems difficult to fix.
I've started using EurekaLog (fantastic!) and SmartInspect. Both these tools have helped greatly but I'm still finding it difficult to catch some problems.
I've just purchased Debugging by David Agans (and waiting for it to arrive).
Are there any other tools or techniques specific to Delphi that will help with catching these hard to find remote problems? The kinds of problems I'm finding difficult to track down are those that don't raise exceptions or have a clear cause. EurekaLog catches exceptions and SmartInspect is pretty good once I have a theory to check. But in some cases it is a seemingly random crash and there are several thousand lines of code that may may be at fault. How to narrow down to the root cause?
MadExcept is what I use, and it is fabulous. I have also used EurekaLog and find the functionality almost exactly identical, except that I have more experience and time using MadExcept. it's free for non-commercial use, and reasonably priced for commercial use.
Update: MadExcept 4 is now out and even supports 64 bit Delphi XE2 apps, and has memory-leak checking too.
When nothing blows up, I rely on heavy use of trace logging. I have a TraceMessage(integer,string) function which I call throughout all my apps, and when someone has problems I get them to click a menu item that turns up the debug trace level to the most verbose level; it gives me a complete history of everything my application did, and this has helped me even more than madExcept, to solve problems at customer sites. Customers get a crash, and that crash report sent by madexcept contains a log file (created by my app) that is attached automatically. I believe you can do this equally well with madExcept and EurekaLog. If you need a logging system you could download Log4D, or you could write your own, it's pretty simple.
For always-free, try JclDebug, which requires more work to set up, but which has worked fabulously for me, also.
For help with heap problems, learn more about fastMM (full version) debug options.
And you shouldn't forget that Delphi itself supports Remote debugging, if you can reproduce a crash on machines in your office that don't have delphi installed, use remote debug across the office network instead of installing a complete RAD Studio installation on that other machine at your work. You could also use remote debug to connect to a client PC computer across the internet, but I have not tried remote debug across the internet yet, so I can't say whether it works great over the internet or not. I do know that since remote debug doesn't support automatic deploy of the EXE file you built (you have to do that part yourself), remote debug over internet, to a client PC is more work.
You might also find lots of your problems by fixing all your hints and warnings, and then going through with CodeHealer or Pascal Analyzer (PAL) from Peganza. These static analysis tools can help you find real code problems.
If performance and memory usage are your problems, get the full version of AQTime, and use it to profile and watch your system operate. It will help you fix your memory leaks, and understand your app's runtime behaviour and memory usage, not just leaks but bottlenecks for memory and CPU usage. Some of those bottlenecks can also be the source of some odd problems. I have even used AQTime to help me find deadlocks, since it can generate traces of execution, that can help me figure out what code is running, and locate deadlocks. Update: AQTime is not installable on machines other than your main dev machine, without violating the newly modified license terms for AQTime. These terms were never this restrictive in the good old days.
If you gave more exact idea of what your problems are, I'm sure other people could give you some more ideas that are specific, but all of the above are general techniques that have served me well.
One of the best way is to use the Remote Debugger that comes with Delphi, so you can debug directly the application running on the remote machine. THe remote debugger is somewhat buggy in some Delphi releases, and requires to follow the instructions carefully to make it working, but when needed it's a tool to consider. Also check if there are updates available for your version, they could come in a separate installer for deployment on "remote" systems. Otherwise first install the remote debugger, than check if the files installed has newer versions in your local installation, and the copy tehm on the remote machine.
CodeSite has helped me a lot in these situations. Since XE it is bundled with Delphi.
Logging is the key, in this matter.
Take a look at our TSynLog class available in our Open Source SynCommons library.
It does have the JCL Debug / MadExcept features, with some additional (like customer-side profiling, and logging):
logging with a set of levels;
fast, low execution overhead;
can load .map file symbols to be used in logging;
compression of .map into binary .mab (900 KB -> 70 KB);
inclusion of the .map/.mab into the .exe;
reading of an external .map to add unit names and line numbers to a log file without .map available information at execution;
exception logging (Delphi or low-level exceptions) with unit names and line numbers;
optional stack trace with units and line numbers;
methods or procedure recursive tracing, with Enter and auto-Leave using interfaces;
high resolution time stamps, for customer-side profiling of the application execution;
set / enumerates / TList / TPersistent / TObjectList / TContainer / dynamic array JSON serialization;
per-thread or global logging;
multiple log files on the same process;
integrated log archival (in zip or any other format);
Open Source, works from Delphi 5 up to XE.
I'm primarily looking for suggestions on logging components or libraries that are available at low or no cost. I have a Windows service and a client application that both need support for logging to a file. The service needs to also support logging the exact same messages to the event log as well.
I can write something, but if this wheel already exists it would be helpful!
UPDATE:
Turns out my question is a duplicate:
What's the Best Logging Package for Delphi?
Which logging library is better?
I recommend the Log4D open source library:
it requires only one file (Log4D.pas), allows dynamic configuration in code and external configuration through a properties file (flat or XML), and is very easy to use and extend - writing a new appender class which can be configured from the properties file is simple.
For the open source alternative, it sounds like you need the extensible Log4Delphi
I also just found this one: TraceTool
Short description from the source site:
The Swiss-Army knife of trace
A C#, C++, Delphi, ActiveX and Java
trace framework and a trace viewer:
Tail, outputDebugString, event log,
and with Log4J, Log4Net
This came from a similar StackOverflow question
Which logging library is better?
There's also another similar question:
https://stackoverflow.com/questions/84798/whats-the-best-logging-package-for-delphi
this question has been asked many times, and some got really good answers:
Which logging library is better?
and
How can I find out which exceptions a Delphi function might throw?
For a commercial solution (and commercial costs), the oldest (?) is CodeSite from Raize.
i have an application which call another console application and pass to it some parameters (console app is a video/audio coverter app) ... is there a way to programmatically "spy" or catch the passed paramters other than hooking/monitoring shellexecute/CreateThread etc ?
Create an executable yourself that just calls the original and passes all parameters on to it. Then move the original somewhere else and replace it with your exe. Your program can then log all calls to it, including all parameters.
Yes, there is - as you write Process Explorer is able to do it, and you could employ the same technique. But AFAIK there's no Delphi translation of the winternl.h file from the Platform SDK, so it is even more tedious and difficult. Also this is extremely version-specific, and there are chances it will break with the next Windows version. It's also not quite clear whether this works for 64 bit processes (from a 32 bit process).
If you really want to do it you will find the necessary information in this blog posting by Matt Pietrek, and in the CodeProject article "Read Environment Strings of Remote process".
If you do not plan to use it for closed source commercial programs then a look into the (GPL licensed) annotated version of the winternl.h file from the ReactOS project would probably also help.
It's a Win32 FAQ since 1992 : just read the PEB.
See on Win32 experts group.
I'm finishing an internship at a company and have just been thrown onto this project for the last month where the program is built upon an engine that they "failed" to buy the source code for. Now I've been given the task of finding out why it is failing, on only certain conditions and customer feedback hasn't been great. The main developer for the project is also out on leave for several months.
I have the engine install and know the language it was written in (delphi6?).
note which I have never had to use
I have our products msi.
I'm expected to go through the regular app and pinpoint the problem. I suspect it is something to do with fields not being re-initialized properly.
Is there a way to attach a debugger to the exe to see callstacks and all that hotness?
Any help that would avoid countless use cases would be received gratefully.
You can attach the Delphi debugger to any running process (like all other win32 debuggers out there) but I don't think the experience will be near what you expect. Delphi produces really tight executables which means the info for building human readable callstacks or any kind of "hotness" are simply not there.
Your only chance is in that if your application is a Debug release. In that case, Delphi debugger should help more than a generic debugger.
You might also want to have a look at this thread - Is there a program to decompile Delphi?
In Delphi 2006 (not sure about 6) you can attach the debugger to a running process.
You only get assembler instructions, registers, flags, memory dump and stack (hex). Hope that is enough.
Nice, I tried to attach to the ide/debugger and they disallowed that ;-).