Re: Application Logging
- From: "Dag Sunde" <dag@xxxxxx>
- Date: 22 Feb 2006 09:37:51 +0100
"Frank Adam" <fajp@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:mi1ov1p9boliibaf9lk6vfffrpau630qe0@xxxxxxxxxx
On Tue, 21 Feb 2006 21:32:12 -0600, "WebBiz"
<justask@xxxxxxxxxxxxxxxxx> wrote:
Now that I'm getting strange problems reported by my testors that I cannotWhat i usually do is to write a function that handles the logging, and
seem to duplicate (such as "the program does not start but shows up in the
task manager"), I'm thinking I should start adding some code to log
various
events within my code.
After a search on the net I found some code for LogIt in a VBPJ site back
in
1999. Thing is, it is weak on instructions and complicated is the last
thing
I need.
From you experts, what would you suggest is a nice, clean easy way to goabout setting up my application to produce some sort of log that testers
can
send me in order to determine what/where the program is hanging? Are we
just
talking about opening a file on disk in the Main() and then toss in a ton
of
one-liners like "Here starts the Dumbo flying procedure..."? And what
about
slowing the code down with something like this?
Any advice?
each suspect area will have a line or sixteen<g> added to send the
info to it if a debug flag is set.
You'd start the app with a command line switch '/d' setting debugFlag
in Sub Main and the inserted lines would look something like :
if debugFlag then Call DoLog(module, procedure, extra info)
If started without the '/d' it would just bail on each line, so the
performance hit would be negligable.
Once the bugs are squashed, a simple loop can run through all the
modules and remove all if debugFlag and related lines.
You could also start by just logging entry and exit from each
function, then when you see which area(s) of code are causing the
problems, tighten the noose just around those procedures and spit out
every major step, then later every line if needed.. It may take a few
steps that way, but once you see which procedure is causing the
errors, it may just all make sense at once.
Great minds think alike... ;-)
Excactly how I doo it too.
I have separated the Log function into a class in its own AX dll,
that logs to App.Path & "\log\" & App.Name & ".log"
That way I can use it from any of the utility dll's my app is using,
or the app itself.
I've also put in a 'severityLevel', so errors get logged even if the
app is started without the -Debug setting.
I have also put in a config-file where you can specify if it should log
to the Event-log or to File.
--
Dag.
.
- References:
- Application Logging
- From: WebBiz
- Re: Application Logging
- From: Frank Adam
- Application Logging
- Prev by Date: Re: Application Logging
- Next by Date: Re: search in csv file
- Previous by thread: Re: Application Logging
- Next by thread: Re: Application Logging
- Index(es):
Relevant Pages
|