Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 911023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:08:03+00:00 2026-05-15T17:08:03+00:00

I’m debugging some unexpected behavior and while tracing in to the .NET framework I

  • 0

I’m debugging some unexpected behavior and while tracing in to the .NET framework I see a bunch of stuff like this:

        if (Logging.On) { 
            Logging.PrintInfo(Logging.Web, this, SR.GetString(SR.net_log_n_certs_after_filtering, filteredCerts.Count));
             …
        }

But (as expected by default) the execution steps right over these. Is there some way to turn on the logging? Or is that just something that the framework developers can do while making special builds of the framework?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T17:08:04+00:00Added an answer on May 15, 2026 at 5:08 pm

    Reflectoring around shows that Logging.On is enabled by ‘flag’ in

    s_WebTraceSource = new NclTraceSource("System.Net");
    s_HttpListenerTraceSource = new NclTraceSource("System.Net.HttpListener");
    s_SocketsTraceSource = new NclTraceSource("System.Net.Sockets");
    s_CacheTraceSource = new NclTraceSource("System.Net.Cache");
    try
    {
       flag = ((s_WebTraceSource.Switch.ShouldTrace(TraceEventType.Critical) || s_HttpListenerTraceSource.Switch.ShouldTrace(TraceEventType.Critical)) || s_SocketsTraceSource.Switch.ShouldTrace(TraceEventType.Critical)) || s_CacheTraceSource.Switch.ShouldTrace(TraceEventType.Critical);
    }
    

    This implies it’s using standard tracing and just checking to see if at least the “Critical” level is being watched. A sample of how to use this can be found in the “Debugging a Sockets Application” section of this MSDN article as in:

    <configuration>
      <system.diagnostics>
        <sources>
          <source name="System.Net.Sockets">
            <listeners>
              <add name="Sockets"/>
            </listeners>
          </source>
        </sources>
        <switches>
          <add name="System.Net.Sockets" value="31" />
        </switches>
        <sharedListeners>
        <add name="Sockets" type="System.Diagnostics.TextWriterTraceListener" 
          initializeData="Sockets.log"/>
        </sharedListeners>
        <trace autoflush="true" />
      </system.diagnostics>
    </configuration>
    

    As the article explains, the switch values are bitwise OR’s of these five values:

    • Network traffic (0x10)
    • Method entry and exit (0x8)
    • Warnings (0x4)
    • Errors (0x2)
    • Critical events (0x1).

    If you OR all of these (0x10 | 0x8 | 0x4 | 0x2 | 0x1) you get 0x1F which is “31” in decimal as seen above.

    Details on setting using an application configuration file can be found here. It should just be a matter of creating an app.config or web.config file similiar to the one above for the source(s) that you’ll use.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was pondering this question last night while debugging some things in IE7, when
While debugging some code in gdb, I want to see which line will be
While debugging some code I got something like below: #include<stdio.h> int main() { FILE
I need help debugging some odd file behavior in Python. Take the following script
I have some debugging code that if executed while running with GBD attached should
I am debugging some code, and would like to throw an error without actually
I am debugging some JavaScript and can't explain what this || does: function (title,
I would appreciate help debugging some strange behavior by a multiset container. Occasionally, the
I'm debugging some code and this is throwing me a fit. This is a
I am debugging some Entity Framework code in Visual Studio 2008, and I'm trying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.