有没有办法从 wss 或 moss 中的农场中的所有服务器获取 ULS 日志。我需要使用 C# 以编程方式获取日志。我可以从农场中的一台服务器获取日志,但我需要所有这些日志。任何帮助表示赞赏。
最佳答案
您可以使用 ULS 查看器: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
关于c# - ULS 登录 sharepoint 2007,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10738067/