Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System.Net.GlobalLog - How do I view the output of this?

Many classes in the .NET framework (especially in the socket/network classes, which is what I'm looking at) use System.Net.GlobalLog (an internal class) to log trace messages somewhere. You can view example uses of things like GlobalLog.Assert and GlobalLog.Print in the SslState class:

SslStream source code

This is different from the System.Net.Logging (also internal) class, uses of which can also be found throughout the socket/network classes.

For System.Net.Logging, I know I can use a <system.diagnostics> configuration block in App.Config and that will result in System.Net.Logging messages getting logged if configured properly. However, this does not appear to influence System.Net.GlobalLog.

After searching around for about an hour, I cannot seem to find any information about locating the output of System.Net.GlobalLog. Does anyone know how to locate/view/control the output of this?

like image 781
Nick Williams Avatar asked Nov 12 '12 19:11

Nick Williams


People also ask

How do I check .NET logs?

Logging to Event Viewer for web or desktop applications When users run a compiled and released Windows app, there is no console to view the logs. Instead, Windows offers a standard place to store log messages called the Windows Event Log. You can view these events with the Event Viewer.

What is .NET logging?

Logging is essential for a software development project, but it's often disregarded until the program crashes. Logging serves numerous purposes including root cause analysis, bug analysis, and even performance reviews for the application. With . NET, the programmer can log to several locations and not just a flat file.

Why is .NET logging important?

Context is important to understand any issues that occur in an application. Using contextual items available in an application such as the request, current thread, state, user information and timestamp provides context to . NET error log messages.

What is a log in C#?

Log(Double, Double)Returns the logarithm of a specified number in a specified base. public: static double Log(double a, double newBase); C# Copy.


1 Answers

As you stated, GlobalLog is an internal class to the System.Net assembly. Without being able to modify the System.Net assembly you won't get access to that class.

That said, you might want to review the following: http://www.123aspx.com/rotor/RotorSrc.aspx?rot=42941

It looks like you have to have compiler flags TRAVE and DEBUG set in order to get it to work.. but I'm not seeing where it actually does anything with the logged information. The comments suggest that it is supposed to look for an environment variable setting and dump the log to a text file somewhere on the system; however the code at that page seems either incomplete or it simply wasn't finished.

My guess is that you need to find some other way of getting access to the logging info you want.

like image 175
NotMe Avatar answered Sep 21 '22 10:09

NotMe