2

http://msdn.microsoft.com/en-us/library/aa979522.aspxで提供され、/en-us/library/aa979595.aspx で説明されているSharePoint トレース ログ サンプルは、Sharepoint 2010 では機能しません。 Web パーツからトレース ログに書き込む方法 (非サンドボックス)

4

1 に答える 1

2

.NET アプリからSharePoint 2010 の ULS ログに書き込む方法

これは SP2010 で大幅に改善されました。SharePoint Foundation を使用しても、ULS ログに簡単に書き込むことができるようになりました。あなたがしなければならないのはこれだけです:

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 );

うまく機能しますが、サンドボックス ソリューションでは利用できません...

于 2010-03-26T08:01:55.363 に答える