logging to Database

Topics: Logging Application Block
Jun 14, 2010 at 3:39 PM

Hi All

I am logging to a database trace listener, and have ticked the callstack and logicaloperationcallstack, and called write(logentry) but the callstack doen't seem to get included in the database.

Anyone got any thoughts ?

Paul

 

Jun 16, 2010 at 1:51 AM

I assume you meant you used the CallStack and LogicalOperationCallStack as the value for TraceOutputOptions?  TraceOutputOptions determine what information should be included when tracing.  Are you performing logging or tracing?  If you're logging, the Formatter's Template property determines what should be included in log entries.  However, the callstack and logicaloperationcallstack are not part of the built-in tokens.  You could include them in the logs by adding them to the ExtendedProperties collection property of a LogEntry object and its content will be automatically included in the log entries if you included the  {dictionary({key} - {value} token in your formatter's template.

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Jun 18, 2010 at 4:14 PM

Hi Sarah

I am only logging.

I notice that this is inconsistant between the xml listener which adds the call stack automagically.

I have looked in the formatter template editor and the call stack seems to be missing.

Can I extend the formatter to add the callstack ( assuming its possible to add the callstack )

I have rolled my own database listener adding a callstack column to the database and inheriting from logentry with new field,  can the application block framework automagically fillin the property ?

Regards

Paul

 

Jun 22, 2010 at 11:02 AM

Hi Paul,

Yes you can both extend the Formatter and Database Trace Listener to add a CallStack property wherein you can retrieve its value from your TraceData method of your custom trace listener in its TraceEventCache object parameter. 

Gino Terrado
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com