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?
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.
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.
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.
Log(Double, Double)Returns the logarithm of a specified number in a specified base. public: static double Log(double a, double newBase); C# Copy.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With