Application for easy tracing on .NET platform. Inspired by elmah and Hangfire.
Hangfire is available as a NuGet package. So, you can install it using the NuGet Package Console window:
PM> Install-Package PugTrace.SqlServer
After install, update your existing OWIN Startup file with the following lines of code. If you do not have this class in your project or don't know what is it, please read the Quick start guide to learn about how to install Hangfire.
using PugTrace;
using PugTrace.SqlServer;
public void Configuration(IAppBuilder app)
{
GlobalConfiguration.Configuration.UseSqlServerStorage("<connection string or its name>");
app.UsePugTraceDashboard();
}
Then you need to configure System.Diagnostics
to use PugTrace listener.
<system.diagnostics>
<sharedListeners>
<add name="sqldatabase"
type="PugTrace.SqlServer.SqlServerTraceListener, PugTrace.SqlServer"
initializeData="<connection string or its name>"
applicationName="<application name>" />
</sharedListeners>
<sources>
<source name="Application" switchValue="All">
<listeners>
<clear />
<add name="sqldatabase" />
</listeners>
</source>
</sources>
</system.diagnostics>
You can then log your traces like this.
TraceSource source = new TraceSource("Application");
source.TraceInformation("Hello world!");
source.Flush();