【问题标题】:Trace log Example does not work in Sharepoint 2010跟踪日志示例在 Sharepoint 2010 中不起作用
【发布时间】:2011-01-18 17:10:06
【问题描述】:
【问题讨论】:
标签:
sharepoint
trace
sharepoint-2010
logging
web-parts
【解决方案1】:
来自How to write to ULS Log in SharePoint 2010 from a .NET app?
这在 SP2010 中确实得到了改进。
现在您可以写入 ULS 日志
即使使用 SharePoint 也很容易
基础。你所要做的就是
这个:
SPDiagnosticsService diagSvc = SPDiagnosticsService.Local;
diagSvc.WriteTrace( 0, // custom trace id
new SPDiagnosticsCategory("My category",
TraceSeverity.Monitorable,
EventSeverity.Error), // create a category
TraceSeverity.Monitorable, // set the logging level of this record
"Writing to the ULS log: {0}", // custom message
new object[] { "SharePoint rocks!"} // parameters to message );
效果很好,但不适用于
沙盒解决方案...