How do you log debug messages in shipped code?

Posted by Peter Judge on 05-Dec-2014 08:49

I've recently started adding debug log messages to shipping code under a IF SESSION:DEBUG-ALERT THEN condition. This works well enough but has resulted in some confusion (since it's not really documented as such) when consumers of the code add session:debug-alert for their own purposes.

How do you do this sort of thing? LOG-MANAGER? Your own logging framework?

-- peter

Posted by Roger Blanchard on 05-Dec-2014 09:18

Jeff,
 
We typically always have some sort of tracing enabled…by default when our app is installed our tracing is set to error only. If a customer reports an issue and we do not see anything in the log we would have them increase the logging level and then send debug files when it occurs again.
 
Roger Blanchard

All Replies

Posted by Roger Blanchard on 05-Dec-2014 08:52

Peter,

At one point we had our own logging framework but we moved to the LOG-MANAGER with different application trace levels. This works just fine for us.

Posted by Jeff Ledbetter on 05-Dec-2014 09:14

Richard, can you expand a little more on this? If a user reports an issue, do you have them restart the application with the appropriate logging level and dupe the issue again, or… ?
 
I’ve tried a few different approaches and I’ve not come up with something that I am completely happy with.
 
Jeff Ledbetter
skype: jeff.ledbetter
 
[collapse]
From: rblanchard [mailto:bounce-rblanchard@community.progress.com]
Sent: Friday, December 5, 2014 8:53 AM
To: TU.OE.Development@community.progress.com
Subject: RE: [Technical Users - OE Development] How do you log debug messages in shipped code?
 
Reply by rblanchard

Peter,

At one point we had our own logging framework but we moved to the LOG-MANAGER with different application trace levels. This works just fine for us.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]

Posted by Roger Blanchard on 05-Dec-2014 09:18

Jeff,
 
We typically always have some sort of tracing enabled…by default when our app is installed our tracing is set to error only. If a customer reports an issue and we do not see anything in the log we would have them increase the logging level and then send debug files when it occurs again.
 
Roger Blanchard

Posted by Peter Judge on 05-Dec-2014 09:24

So you always have logging enabled, and tweak the log-level on the fly to show more or less?
 
-- peter
 
[collapse]
From: rblanchard [mailto:bounce-rblanchard@community.progress.com]
Sent: Friday, 05 December, 2014 10:19
To: TU.OE.Development@community.progress.com
Subject: RE: [Technical Users - OE Development] How do you log debug messages in shipped code?
 
Reply by rblanchard
Jeff,
 
We typically always have some sort of tracing enabled…by default when our app is installed our tracing is set to error only. If a customer reports an issue and we do not see anything in the log we would have them increase the logging level and then send debug files when it occurs again.
 
Roger Blanchard
Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]

Posted by Roger Blanchard on 05-Dec-2014 09:28

Yes.
 
Roger Blanchard

Posted by Marian Edu on 05-Dec-2014 12:13

You mean wrapping log-manager as yet another logging service implementing a given interface in framework :)

Posted by Mike Fechner on 06-Dec-2014 09:12

“I’ve tried a few different approaches and I’ve not come up with something that I am completely happy with.“
 
Jeff, would you share more details with us?

Posted by Mike Fechner on 06-Dec-2014 09:16

We are using a static class to extend the LOG-MANAGER.
 
LOG-MANAGER:WRITE-MESSAGE’s most annoying feature is that it generates a warning when there is no logfile on the client.
 
LOG-MANAGER:WRITE-MESSAGE lacks the ability to have custom logging subsystems that you may turn on and off at runtime.
 
Plus we needed the ability to turn on various log-entry-types + application logging subsystems from the client for AppServer requests from a specific client – in case you want to monitor what’s happening on the AppServer for specific clients.
 
Plus a few additional API’s, like logging a buffer content (all fields), integrated substitute, etc…

 

Posted by Rom Elwell on 06-Dec-2014 09:31

I concur with Mike's comment regarding the lack of functionality in LOG-MANAGER:WRITE-MESSAGE to turn on or turn off custom logging subsystems at runtime.  

We use preprocessor directives and conditional blocks to set the various logging/debugging states that we wish to trap.  This 'solution' requires that we recompile the *.R files in which we want to change the logging/debugging state.  I acknowledge this is not a lightweight solution, yet it serves our needs at this moment.

Posted by Jeff Ledbetter on 08-Dec-2014 07:28

Gladly, but the details are not that interesting.  Maybe “debugging” isn’t the proper word… J
 
Let me preface by saying that most (if not all) of our customers are pretty technical so that provides a bit of comfort level when it comes to asking customer to restart appservers, adding logging levels, etc. If our customers were non-IT types than a different approach would be necessary.
 
The most prevalent method we use is to log unexpected errors at the moment they occurred, format the error message to include the PROGRAM-NAME function, and pass that back out to the caller. Usually this includes enough information for our support to have a good idea of what went wrong. Many of our customers start their sessions with –debugalert so they can send us the stack-trace right away as well. Although, they may not necessarily be a useful stack-trace.
 
Another approach we do is using the ERROR-STACK-TRACE. Since the OE user guide suggests this could impose a performance penalty, we only use it when speed is not the top priority.  At the top level of the process, we turn it on and then turn it back off in a finally block In these cases when an error occurs, we have the opportunity to capture the trace for the exact error occurs. We also write XML of any relevant data.
 
Our fallback is our course having users change the logging level and types, restart their session, and try to dupe again and send us the log. That is, of course, the least preferred method but sometimes necessary.
 
In our plug-in, we can enable debugging at the package level which will output the data moving back and forth between the server to the Eclipse console. That is pretty helpful as well.
 
Jeff Ledbetter
skype: jeff.ledbetter
 
[collapse]
From: Mike Fechner [mailto:bounce-mikefechner@community.progress.com]
Sent: Saturday, December 6, 2014 9:13 AM
To: TU.OE.Development@community.progress.com
Subject: [Technical Users - OE Development] AW: How do you log debug messages in shipped code?
 
Reply by Mike Fechner
“I’ve tried a few different approaches and I’ve not come up with something that I am completely happy with.“
 
Jeff, would you share more details with us?
Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]

This thread is closed