This project is read-only.



Default framework’s diagnostic subsystem allows to store all the major application events into a database and do postmortem analysis or review application workflow, performance, etc. At the moment, trace subsystem is implemented and the following are the most important interfaces:

  • ITrace – represents a tracer for tracing subsystem 

     The interface defines the behavior of logging trace records of different types:

  • Info
  • Warn
  • Error
  • Fatal

You can interpret these types in program as you wish

  • ITraceCategory – represents a trace category which helps to group trace records
  • TraceRecord – represents a single trace record

Usage of tracing

You can use the default implementation of tracing which logs trace messages into local database and/or add your custom one. The following section in your application.config file should be defined:

      <!-- trace subsystem-->
        <trace name="default" type="PhoneCore.Framework.Diagnostic.Tracing.DefaultTrace, PhoneCore.Framework">
          <storage connectionString="Data Source=isostore:/tracedb.sdf">
                <type name="Info" />
                <type name="Warn" />
                <type name="Error" />
                <type name="Fatal" />
          <controller type="PhoneCore.Framework.Diagnostic.Tracing.DefaultTraceController, PhoneCore.Framework" 
                      template="Resources/Templates/DefaultTraceReport.txt" />

PhoneCore framework will create the list of traces define here.

After the definition of the traces in configuration, you can use it using the TraceFactory class which exposes two static methods to access the configured traces:

  • GetTrace() – returns default trace
  • GetTrace(string name) – returns trace by name
  • GetTraceCategory(string name) – returns trace category

Here is the example of trace usage:


private static readonly ITrace _trace = TraceFactory.GetTrace();
private static readonly ITraceCategory _categoryTo = TraceFactory.GetTraceCategory("Navigation.To");
_trace.Info(_categoryTo, String.Format("Navigate to {0}", pageUri)); 
This code uses the default trace which writes Info message using "Navigation.To" category which will create automatically at the first call of TraceCategory.GetInstance()The another way to get trace is use container:

_trace = container.Resolve<ITrace>();
 _category = container.Resolve<ITraceCategory>("FileSystemService");
This is possible because the core bootstrapper registers these services at startup. Here is the sample of results:


Last edited Feb 11, 2012 at 10:18 PM by Ilya_Builuk, version 8


No comments yet.