有没有办法从wss或moss中场的所有服务器获取ULS日志?我需要使用C#以编程方式获取日志。我可以从场中的一台服务器获取日志,但我需要所有的日志。感谢您的帮助。
发布于 2012-05-24 21:14:29
您可以使用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
https://stackoverflow.com/questions/10738067
复制相似问题