SharePoint 场中的协调日志记录

发布于 2024-08-30 19:11:19 字数 718 浏览 4 评论 0原文

我们正在将 Web 部件部署到 SharePoint 2007,并希望包括日志记录 (log4net)。理想的解决方案是使用数据库附加程序来避免了解哪个实际服务器正在执行 Web 部件的问题。

这些问题很有帮助:SharePoint 和 Log4Net

我已经使用 Visual Studio 开发服务器在独立的 Web 应用程序中工作了 log4net,使用 web.config 作为 log4net 设置,并使用文件附加程序作为输出。我想转换到 SharePoint 并仍然使用日志文件输出,这样我就可以确保一切正常工作,然后更改配置以记录到数据库。

这样会不会太麻烦了?其他开发人员如何将 log4.net 添加到他们的 SharePoint 解决方案中?使用数据库是将日志输出关联到服务器的唯一好的解决方案吗?

更新:我们已经实现了 Log4Net 并且它在一定程度上有效。 SharePoint 的安全模型使配置必要的权限变得更加困难。在我们的例子中,我们看到在某些情况下消息不会进入日志文件。我们在作为给定帐户运行的 Web 服务中使用了日志记录代码。当我们让它作为开发人员运行(例如“us\bob”)并且该开发人员使用调用 Web 服务的页面时,消息就会写入日志文件。另一个未解决的问题是如何考虑写入系统使用的日志目录(即 IIS 日志或 SharePoint 日志)所需的权限。

We are deploying web parts to SharePoint 2007 and would like to include logging (log4net). The ideal solution would be to use a database appender to avoid the problems with knowing which actual server is executing the web part.

This questions has been helpful: SharePoint and Log4Net.

I've got log4net working in a stand-alone web app using Visual Studio dev server using the web.config for the log4net settings and a file appender for the output. I'd like to transition to SharePoint and still use the log file output so I can make sure it's all working first, then change the config around to log to a database.

Is this going to be too much trouble? How have other developers added log4.net into their solutions for SharePoint? Is using a database the only good solution to correlating log output to a server?

Update: We have implemented Log4Net and it works to a point. The security model of SharePoint makes configuring the necessary permissions more difficult. In our case we saw that messages would not make it to the log file in certain cases. We used the logging code in a web service that runs as a given account. When we let it run as a dev, e.g. 'us\bob' and that dev uses a page that calls the web service, then the messages make it to the log file. Another unresolved issue is how to take into account the permissions needed for writing to a log directory used by the system, i.e. IIS logs or SharePoint logs.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

画离情绘悲伤 2024-09-06 19:11:19

切换配置以使用数据库附加程序当然很容易。您需要决定如何连接到数据库:集成身份验证与 SQL Server 登录,但这两种方式都易于配置。

我建议将 log4net 部署为单独的解决方案,因为 Sharepoint 不跟踪程序集的依赖关系。这同样适用于您的解决方案将使用的其他“核心”组件。看看这个问题 在这里

Switching the configuration to use a database appender is certainly easy. You will need to decide how you want to connect to the database: Integrated Authentication vs. SQL Server Login, but both is easy to configure.

I recommend to deploy log4net as a separate solution since Sharepoint does not track dependencies on assemblies. The same applies for other "core" assemblies that your solutions are going to use. Have a look at this question here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文