How to write your own trace logs

The magic is :

Epicor.Hosting.Trace.ServerLog.WriteTraceMessage(
“trace://ice/mytrace”,
“TraceCategoryLabel”,
() => “Some Text”
);

such as the following on Ice.Tip.GetRows

If you have that trace flag in appserver.config:
image

It will output to your tracelog:

NOTE:
The trace writes are using a func for the message text. This allows for a ‘call back’ approach. e.g. - Don’t build up your message if the trace is not active. Amazing how that speeds up things when you have hundreds of trace.writelines all over the server and are not tracing.

7 Likes