ASPCompiler TraceMsg Object
ASP Compiler 1.1 documentation is under development. See also the examples.

newObjects.utilctls.TraceMsg object

This class is implemented in the DbgPrinter.dll. It is installed with the ASP Compiler but you may need to deploy this component to your server or another machine. It is a freeware and is not related to the ASPC license. 

To use this component you will need additional tool - which shows the debug messages. ASPC does not provide such functionality because such tools exist as freeware on the Internet. Probably the best one is the DebugView of Sysinternals - which supports trapping of messages from another machines on the network and filtering.

What is the reason to use such feature? This component allows you to issue messages from any application - including application working on the WEB server. Sometimes logical mistakes are hard to find and some trace messages are exactly what the developer needs in order to find the problem. It is very  hard to trace an ASP page or sometimes the problem occurs only in the productive environment. Thus using the TraceMsg object you can issue them from the ASP page (no matter if it compiled or not) while it works. The object is Free-Threaded thus you can place it in the Session variable and enable debugging for one session (yours). Yes it is possible to issue such messages directly in the output but adding them one by one brings the page layout which is hard to understand even for the developer. Thus trapping the messages with additional tool from outside leaves the page visual output intact.

It contains only one method and one property:

Method Msg

Example:
Set dbg = Server.CreateObject("newObjects.utilctls.TraceMsg")
dbg.Msg "A trace message"

It accepts one parameter of type string. If the Disable property is set to False then the message will be passed to the system OutputDebugString function and can be viewed using an appropriate debug tool (see above).

Property Disabled

Example:
Set dbg = Server.CreateObject("newObjects.utilctls.TraceMsg")
dbg.Disabled = False

dbg.Msg "A trace message"
It is a Boolean read/write property. Default value is True (i.e. debug messages are discarded). Set to true to enable debugging.

Remarks

When using in a WEB server application running on the production system enabling all the trace messages may lead to a huge amount of trace messages which will not be of use, because they will be used from pages processing requests of another clients. Typically the application logic can be traced through the life time of one user session. Thus the best way will be to put one object in every Session and create a simple page which sets its Disabled property to False for the current session (your session). This will enable debug messages only from the pages in your ASP session and you will keep their number low.

ASP Compiler has a directive DbgTrace which allows you to mark some statements as available only in the debug builds. Use this object together with it and you will be able to discard the debug related statements in the release builds without deleting them all manually.

newObjectsSite4All.nl Copyright 2001-2006 newObjects [ ]