Trace logging method that allows you to write out trace messages to a trace log file. The default file is wcTraceLog.txt and is written to the server's startup folder.
This method is useful if you need to debug code that you can't debug directly such as COM Server or application startup code. Because the Server object is always available this method can be accessed from anywhere within the application with:
Server.Trace("OnInit Started") ... Server.Trace("OnInit Completed")
The log file writes each entry with a date plus the string. While you can write out any string value, it's best to write single line entries for easier reading and parsing of the log data. However, long strings or detail values are supported.
Here's what the trace output looks like:
2015-03-13 14:04:35 - OnInit Started 2015-03-13 14:04:35 - OnInit Complete 2015-03-13 14:04:35 - OnLoad Started 2015-03-13 14:04:35 - OnLoad Complete
The message to put into the tracefile.
Optional - The file name to write out to. Defaults to
Trace output goes to a file on disk by default and while disk access is fast, it is a blocking and locking operation. So for best performance do not leave trace commands in your application code. Use this feature for debugging and when you're done remove the trace commands.
You can override the Trace function in your own server subclass and send output to other data stores that are more efficient or more persistent if you choose.
Note that you can also use the wwServer::LogError() which logs to the Log database.
See also:Class wwServer
Comment or report problem with topic