简体   繁体   English

ULS登录sharepoint 2007

[英]ULS Logs in sharepoint 2007

Is there a way to get ULS Logs from all servers in a farm in wss or moss. 有没有办法从wss或moss中的服务器场中的所有服务器获取ULS日志。 I need to obtain logs programmatically using C#. 我需要使用C#以编程方式获取日志。 I can get logs from one server in a farm, but I need all of them. 我可以从服务器场中的一台服务器获取日志,但我需要所有这些日志。 Any help appreciated. 任何帮助赞赏。

You could use the ULS Viewer: http://ulsviewer.codeplex.com/ 您可以使用ULS Viewer: http//ulsviewer.codeplex.com/

Or you could write your own logging service using SPDiagnosticsService 或者您可以使用SPDiagnosticsService编写自己的日志记录服务

http://msdn.microsoft.com/en-us/library/gg512103.aspx http://msdn.microsoft.com/en-us/library/gg512103.aspx

Edit from the comments: 从评论中编辑:

To read files directly you could do: 要直接读取文件,您可以:

   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 http://msdn.microsoft.com/en-us/library/system.io.streamreader.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM