Reputation: 44308
This is wrecking my head and the documentation seems to be non-existent for this library. I have a Rolling Flat file listener... I want to include the callstack in any messages that get written to the listener.
<add name="RollingFileLog"
fileName="C:\Rainmaker\Logs\SampleArchitectureService.Log"
... snipped for brevity
traceOutputOptions="Callstack" />
What do I need to include in my Formatter to get that Callstack/Trace info to appear. Formatter is below
<add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, ..."
name="TextFormatter"
template="{timestamp(local)}: [{category}/{severity}] - {message} - ****WHATGOES HERE***" />
I've tried everything, looking in the extended properties dictionary, using the {property()} and {keyvalue()} tokens for which there is no documentation either.
Can someone please explain to me wht this traceOutputOptions
attribute is for, and if it's for what I think, how the heck do I access those attributes.
Upvotes: 1
Views: 2171
Reputation: 1196
The Trace Output Options from the MSDN page
The TraceOutputOptions property determines the optional content of trace output. The property can be set in the configuration file or programmatically during execution to include additional data specifically for a section of code. For example, you can set the TraceOutputOptions property for the console trace listener to TraceOptions.Callstack to add call stack information to the trace output.
Also remember it's not supported by all the trace listeners http://msdn.microsoft.com/en-us/library/system.diagnostics.tracelistener.traceoutputoptions.aspx
The only way I see to get the CallStack information into your file is through the extended properties dictionary in the text formatter.
template="Extended Properties: {dictionary({key} - {value}{newline})}"
Found an interesting article, this should help you. "How to output TraceOutputOptions values " http://entlib.codeplex.com/discussions/344343
Upvotes: 2