wss または moss のファーム内のすべてのサーバーから ULS ログを取得する方法はありますか。C# を使用してプログラムでログを取得する必要があります。ファーム内の 1 つのサーバーからログを取得できますが、すべてのログが必要です。どんな助けでも感謝します。
1179 次
1 に答える
4
ULS Viewer を使用できます: http://ulsviewer.codeplex.com/
または、次を使用して独自のロギング サービスを作成することもできます。SPDiagnosticsService
http://msdn.microsoft.com/en-us/library/gg512103.aspx
コメントから編集:
ファイルを直接読み取るには、次のようにします。
try
{
// Create an instance of StreamReader to read from a file.
// The using statement also closes the StreamReader.
using (StreamReader sr = new StreamReader("FilePath:\\SharePointlogfile.uls"))
{
string line;
// Read and display lines from the file until the end of
// the file is reached.
while ((line = sr.ReadLine()) != null)
{
Console.WriteLine(line);
}
}
}
catch (Exception e)
{
// Let the user know what went wrong.
Console.WriteLine("The file could not be read:");
Console.WriteLine(e.Message);
}
http://msdn.microsoft.com/en-us/library/system.io.streamreader.aspx
于 2012-05-24T13:14:28.790 に答える