首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >sharepoint 2007中的ULS日志

sharepoint 2007中的ULS日志
EN

Stack Overflow用户
提问于 2012-05-24 21:05:02
回答 1查看 1.2K关注 0票数 3

有没有办法从wss或moss中场的所有服务器获取ULS日志?我需要使用C#以编程方式获取日志。我可以从场中的一台服务器获取日志,但我需要所有的日志。感谢您的帮助。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-05-24 21:14:29

您可以使用ULS Viewer:http://ulsviewer.codeplex.com/

或者,您可以使用SPDiagnosticsService编写自己的日志记录服务

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

从注释中编辑:

要直接读取文件,您可以执行以下操作:

代码语言:javascript
运行
复制
   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

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10738067

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档