There's little restrictions about what the dfdlx:trace function should do. The fn:trace function, which this is based on, says:
In addition, the values of $value, converted to an xs:string, and $label (if supplied) may be directed to a trace data set. The destination of the trace output is ·implementation-defined·. The format of the trace output is ·implementation-dependent·. The ordering of output from calls of the fn:trace function is ·implementation-dependent·.
So we have output trace data however we think makes the most sense.
We currently output to stderr, but that could be difficult for some users of Daffodil (e.g. debugger, API users, etc.) to capture. Instead, we should just log the data using our logger. Since our logging uses the Log4J API, it should be relatively easy for tools to capture and display trace information.
Note that CLI logging goes to stderr by default, so this is functionally no change for the CLI, except maybe with an added [info] or [debug] tag depending on what level we decide trace should be log to.