Share via


Trace Logs

Developers can program their applications to write custom operations messages to the trace log, the same log that SharePoint Foundation uses to log developer-oriented information and events. Writing to the same trace log SharePoint Foundation employs enables third-party developers to view their custom application traces in the larger context of SharePoint Foundation operations, without having to correlate multiple trace logs. In addition, the trace log provides a central destination for information concerning development processes, such as debugging. This alleviates the need for developers to log their development information in other places, such as the Windows Event Log, which are more commonly used by system administrators.

Important

Developers should be aware that the trace logs may be uploaded to Microsoft as part of customer technical service and support. Therefore, you should not write personal data or proprietary information to the trace log.

For information about how to create code that writes to the trace log, as well as sample code that does so, see Writing to the Trace Log.

In addition, SharePoint Foundation provides an interface that enables you to define and expose the categories to use for trace logging messages generated by your application within the SharePoint Foundation Central Administration user interface. Administrators can then use the user interface to set selected properties of those categories, such as event and trace severity, and whether the category is displayed in the user interface.

For more information about defining categories, see Trace Log Categories.

SharePoint Foundation also includes the IDiagnosticsManager class. Because this class implements the interface mentioned previously, administrators can use it to manage the trace categories for SharePoint Foundation. Administrators can also use it to specify properties of the trace log itself, such as the location of the trace log to which to write, and the number of trace log files to keep.

Specifying the Trace Log Location

Administrators can use the LogLocation property of the SPDiagnosticsService class to specify the location of the trace log to which to write.

The actual registry key that specifies the location of the trace log is called LogDir and is located at the following location:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0\WSS]

However, you should never edit this value directly.

See Also

Concepts

Trace Log Categories

Writing to the Trace Log

Trace Log Example