【问题标题】:Trace log Example does not work in Sharepoint 2010跟踪日志示例在 Sharepoint 2010 中不起作用
【发布时间】:2011-01-18 17:10:06
【问题描述】:

http://msdn.microsoft.com/en-us/library/aa979522.aspx 提供的 Sharepoint 跟踪日志示例并在 /en-us/library/aa979595.aspx 中进行了解释在 Sharepoint 2010 中不起作用。关于如何从 webpart 写入跟踪日志的任何想法(非沙盒)

【问题讨论】:

    标签: 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 );
    

    效果很好,但不适用于 沙盒解决方案...

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-11-13
      • 2017-06-27
      • 1970-01-01
      • 1970-01-01
      • 2022-08-17
      相关资源
      最近更新 更多