I can't seem to get trace information from inside my SignalR hub. I am using an MVC4 project and in my MVC controllers trace information is being recorded correctly, however when I use tracing inside my SignalR hub, I am getting nothing.
So for example I am seeing the message from the first line of my controller:
System.Diagnostics.Trace.TraceInformation("Test Controller");
But I am not seeing this message from the first line inside my hub:
System.Diagnostics.Trace.TraceInformation("Test Hub");
My web.config has the following line under <system.web>:
<trace enabled="true"
writeToDiagnosticsTrace="true"
localOnly="false"
mostRecent="true"
pageOutput="false" />
And my system diagnostics is as follows:
<system.diagnostics>
<sources>
<source name="Example Source" switchName="sourceSwitch" switchType="System.Diagnostics.SourceSwitch">
<listeners>
<add name="GlimpseListener" />
</listeners>
</source>
</sources>
<switches>
<add name="sourceSwitch" value="All" />
</switches>
<sharedListeners>
<add name="GlimpseListener" type="Glimpse.Core.TraceListener, Glimpse.Core" />
</sharedListeners>
<trace>
<listeners>
<add name="WebPageTraceListener" type="System.Web.WebPageTraceListener, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</listeners>
</trace>
</system.diagnostics>
As mentioned trace messages from my controller are showing fine both in the Trace.axd page and also in the trace tab of Glimpse.
Welcome any ideas, I've been pulling my hair out on this one.
Maybe this will help you https://github.com/SignalR/SignalR/wiki/Tracing-on-the-server-side
What is pertinent:
<source name="Microsoft.Owin.Host.SystemWeb" switchValue="All">
<listeners>
<add name="traces" />
</listeners>
</source>
<source name="SignalR.Connection">
<listeners>
<add name="traces" />
</listeners>
</source>
<sharedListeners>
<add name="traces" type="System.Diagnostics.TextWriterTraceListener" initializeData="server_traces.txt" />
</sharedListeners>
Using a text listener will work as expected, because it can run "out" the "normal" asp.net pipeline.
Related
I installed Glimpse in my Web project that is using MVC5 via Nuget. I am using Visual Studio 2017 with Resharper. I also am running through IIS so it is giving me back app.company.local rather than using IIS Express and localhost. Could that be the problem?
I have gone through the troubleshooting documentation as well as quite a few questions on here but Glimpse's HUD is not showing up for some reason.
Below are some if not all of the changes made to try and get it to work.
packages.config
<package id="Glimpse" version="1.8.6" targetFramework="net461" />
<package id="Glimpse.Ado" version="1.7.3" targetFramework="net461" />
<package id="Glimpse.AspNet" version="1.8.0" targetFramework="net461" />
<package id="Glimpse.EF6" version="1.6.5" targetFramework="net461" />
<package id="Glimpse.Mvc5" version="1.5.3" targetFramework="net461" />
index.cshtml
added #using Glimpse.Mvc.Html to the top and #Html.GlimpseClient() to the bottom
(there are a bunch of divs and no body tag)
Web.config
<add key="Glimpse:DisableAsyncSupport" value="true" />
<add name="Glimpse" type="Glimpse.AspNet.HttpModule, Glimpse.AspNet" /></httpModules>
<add path="glimpse.axd" verb="GET" type="Glimpse.AspNet.HttpHandler, Glimpse.AspNet" />
<add name="Glimpse" type="Glimpse.AspNet.HttpModule, Glimpse.AspNet" preCondition="integratedMode" /></modules>
<add name="Glimpse" path="glimpse.axd" verb="GET" type="Glimpse.AspNet.HttpHandler, Glimpse.AspNet" preCondition="integratedMode" /></handlers>
<glimpse defaultRuntimePolicy="On" endpointBaseUri="~/Glimpse.axd">
<add type="Glimpse.Mvc.Inspector.DependencyInjectionInspector, Glimpse.Mvc5" />
<add type="Glimpse.AspNet.Policy.LocalPolicy, Glimpse.AspNet"/>
What do I need to do in order to get this to work/show up?
There should be no problem for company.local.
You would just need to go to:
app.company.local/Glimpse.axd
To get to you config display. Then
You have not enabled Glimpse in the web.config, by setting defaultRuntimePolicy to On:
<glimpse defaultRuntimePolicy="On" endpointBaseUri="~/Glimpse.axd">
...
</glimpse>
I am trying to wire up my sinks and it seems for my rolling file sink my debug messages are not being logged (only info and above). Is my configuration wrong?
<!-- Serilog Configuration -->
<add key="serilog:using:Email" value="Serilog.Sinks.Email" />
<!-- Configure Serilog Email Sink -->
<add key="serilog:write-to:Email" />
<add key="serilog:write-to:Email.mailServer" value="***" />
<add key="serilog:write-to:Email.toEmail" value="***" />
<add key="serilog:write-to:Email.fromEmail" value="***" />
<add key="serilog:write-to:Email.mailSubject" value="Comply360 Portal Endpoint (DEV)" />
<add key="serilog:write-to:Email.restrictedToMinimumLevel" value="Warning" />
<add key="serilog:write-to:Email.outputTemplate" value="{Timestamp:HH:mm:ss} [{Level}] [{SourceContext}] [{CorrelationId}] {Message}{NewLine}{Exception}" />
<!-- Configure Serilog RollingFile Sink -->
<add key="serilog:write-to:RollingFile" />
<add key="serilog:write-to:RollingFile.restrictedToMinimumLevel" value="Debug" />
<add key="serilog:write-to:RollingFile.pathFormat" value="C:\Logs\comply360-portal-{Date}.txt" />
<add key="serilog:write-to:RollingFile.outputTemplate" value="{Timestamp:HH:mm:ss} [{Level}] [{SourceContext}] [{CorrelationId}] {Message}{NewLine}{Exception}" />
There is nothing "wrong" with your RollingFile sink config per se - it will only log messages with log level Debug or above (i.e. it will not log Verbose messages) as you intended.
However, the minimum log level for Serilog in general is Information, so it doesn't even send to your sink.
You need to change Serilog's default minimum level to at least Debug, in your case:
<add key="serilog:minimum-level" value="Debug" />
Your final config should look like this:
<add key="serilog:minimum-level" value="Debug" />
<add key="serilog:write-to:RollingFile" />
<add key="serilog:write-to:RollingFile.restrictedToMinimumLevel" value="Debug" />
<add key="serilog:write-to:RollingFile.pathFormat" value="C:\Logs\log-portal-{Date}.txt" />
<add key="serilog:write-to:RollingFile.outputTemplate" value="{Timestamp:HH:mm:ss} [{Level}] [{SourceContext}] [{CorrelationId}] {Message}{NewLine}{Exception}" />
Of course, if you later decide to add any sink that logs Verbose messages and above, you'll need to change the minimum-level to Verbose too.
i.e. serilog:minimum-level should always be the lowest level from all of your sinks.
I have an environmental problem somewhere in OWIN and I want to get some information about what is happening. I have read that I can enable tracing but can't find much information on how to do it.
I have added the following to my web.config but no joy. Is this possible?
<!-- 1. Enable the switch here. Without this, you get nothing. By default, Katana has "new SourceSwitch("Microsoft.Owin")" at the root level. -->
<switches>
<add name="Microsoft.Owin" value="Verbose" />
</switches>
<!-- 2. Add your shared listeners. -->
<trace autoflush="true" />
<sharedListeners>
<add name="file" type="System.Diagnostics.TextWriterTraceListener" initializeData="C:\traces\Microsoft.OWIN.trace.log" />
<add name="console" type="System.Diagnostics.ConsoleTraceListener" />
</sharedListeners>
<sources>
<!-- "Microsoft.Owin" is the SourceSwitch name katana is using at the rootlevel. By enabling this, we are enabling all sub level traces by the components (if we don't change the default trace settings). -->
<source name="Microsoft.Owin">
<listeners>
<add name="file" />
<add name="console" />
</listeners>
</source>
</sources>
Not 100% sure that this will solve your issue, but we got it working with following config. Slight difference in the following line:
<source name="Microsoft.Owin" switchName="Microsoft.Owin" switchType="System.Diagnostics.SourceSwitch">
Notice that the <source> tag includes a switchName (and switchType) attribute which is missing from your example. I think that this instruction links the TraceSource with the Switch and makes the entire work.
In our case, we use trace listeners for Azure Web sites (and web jobs).
<system.diagnostics>
<sharedListeners>
<add name="AzureTableTraceListener" type="Microsoft.WindowsAzure.WebSites.Diagnostics.AzureTableTraceListener, Microsoft.WindowsAzure.WebSites.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add name="AzureBlobTraceListener" type="Microsoft.WindowsAzure.WebSites.Diagnostics.AzureBlobTraceListener, Microsoft.WindowsAzure.WebSites.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add name="AzureDriveTraceListener" type="Microsoft.WindowsAzure.WebSites.Diagnostics.AzureDriveTraceListener, Microsoft.WindowsAzure.WebSites.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</sharedListeners>
<sources>
<source name="Microsoft.Owin" switchName="Microsoft.Owin" switchType="System.Diagnostics.SourceSwitch">
<listeners>
<add name="AzureTableTraceListener"/>
<add name="AzureDriveTraceListener"/>
</listeners>
</source>
</sources>
<switches>
<add name="Microsoft.Owin" value="All" />
</switches>
<trace autoflush="true" indentsize="4" />
</system.diagnostics>
Ok I have a TFS2010 Build Controller Setup as follows
I have 3 VM's each running the TFS Build Host Service
1 has 1 controller and 1 agent
2 have 2 Build Agents each.
Most of the time (7\10 builds) it comes back with the following error message
TF215097: An error occurred while initializing a build for build definition BUILD_DEFINITION: There was no endpoint listening at http://MACHINE1:9191/Build/v3.0/Services/Controller/14 that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
and there is no errors when i do get this message. the following is the config file that i have created
<configuration>
<appSettings>
<add key="traceWriter" value="true"/>
</appSettings>
<system.diagnostics>
<switches>
<add name="BuildServiceTraceLevel" value="4"/>
<add name="API" value="4"/>
<add name="Authentication" value="4"/>
<add name="Authorization" value="4"/>
<add name="Database" value="4"/>
<add name="General" value="4"/>
<add name="traceLevel" value="4"/>
</switches>
<trace autoflush="true" indentsize="4">
<listeners>
<add name="myListener" type="Microsoft.TeamFoundation.TeamFoundationTextWriterTraceListener,Microsoft.TeamFoundation.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" initializeData="c:\logs\TFSBuildServiceHost.exe.log" />
<remove name="Default" />
</listeners>
</trace>
</system.diagnostics>
</configuration>
I do have my own custom activities in my build process but this does not seem to be a problem as sometimes the build actually does go. I have tried refreshing the template as some sites suggest.
Has anyone come across a solution for this problem? or can anyone tell me how to catch these errors when they happen?
This could be an issue with a third-party firewall on your build agents that is not allowing communication from the TFS server. Try disabling any firewalls and see if that resolves your problem.
I'm trying to add a section to an ASP.NET web.config file for using the default profile provider. Here's what I'm adding to web.config in the system.web node:
<profile defaultProvider="AspNetSqlProfileProvider">
<providers>
<clear/>
<add name="AspNetSqlProfileProvider"
type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="ApplicationServices"
applicationName="/"
/>
</providers>
<properties>
<group name="UserDetails">
<add name="FirstName" />
<add name="LastName" />
<add name="BirthDate"
type="System.DateTime" />
</group>
</properties>
</profile>
I can build the website successfully, but as soon as it completes I get the prompt that web.config has been modified outside of the editor and do I want to reload it. I click Yes, and the profile section disappears. Everything else in the web.config file remains intact and functioning correctly.
Any ideas of where to look for troubleshooting this issue? Thanks!
It sounds like you are editing the output config file in the Web site's root and that the build is overwriting with the unedited config held in the ASP.NET project.