log4net 与 Microsoft Dynamics CRM 3.0 标注

发布于 2024-08-16 18:58:28 字数 430 浏览 9 评论 0原文

我正在努力转换 crm 3.0 标注库,并且想使用 log4net 进行日志记录。我能够编译该库并将其部署到我的 crm 服务器,但我似乎无法记录它。我正在使用 RollingLogFileAppender。我将 log4net.config 和库的编译版本放在 \server\ assembly 文件夹中。我在 crm 中启用了跟踪日志,并且此处或事件查看器中没有记录任何错误。我已授予网络服务用户对 \server\ assembly 文件夹的完全访问权限,这也是我配置要写入的 log4net 日志的位置。

当我使用 StreamWriter 编写自己的日志方法时,它确实有效,但我宁愿使用 log4net。

我有一种感觉,log4net 找不到 log4net.config,但我不确定如何确定这一点,而不需要经历远程调试或向 log4net 库添加额外的调试代码的麻烦。

有什么建议吗?

I'm working on converting a crm 3.0 callout library, and would like to use log4net for logging. I am able to get the library to compile and deployed to my crm server, but I can't seem to get it to log. I'm using a RollingLogFileAppender. I put the log4net.config and compiled versions of the library in the \server\assembly folder. I have trace logs enabled in crm and no errors are logged here or in event viewer. I've granted full access rights to the network service user on the \server\assembly folder and this is also where I've configured the log4net logs to be written to.

When I write my own log method using StreamWriter, it does work, but I would rather use log4net.

I have a feeling that log4net cannot find the log4net.config, but I'm not sure how to determine this without going through the trouble of remote debugging or adding additional debug code to the log4net library.

Any suggestions?

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

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

发布评论

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

评论(1

戏剧牡丹亭 2024-08-23 18:58:28

对于插件/工作流活动,您的配置文件将相对于 \Microsoft Dynamics CRM\Server\bin 目录(假设您使用相对路径)。我对 CRMWeb\bin 和 \Server\bin 目录使用单个程序集,因此实际上有两个配置文件。一个位于 CRMWeb\ISV\MyISV\log4net.xml,插件/工作流位于 \Microsoft Dynamics CRM\Server\bin\ISV\MyISV\log4net.xml。

在我的 assemblyinfo.cs 中,我有以下规范:

[ assembly: log4net.Config.XmlConfigurator(ConfigFile = "ISV\MyISV\log4net.xml", Watch = true)]

一旦你确定你正在寻找正确的方向配置文件的位置...如果您在正常滚动文件时仍然遇到问题,请设置 smtp 附加程序以查看是否收到电子邮件。我发现我作为插件/工作流运行的权限非常有限,并且无权访问文件系统。您需要确保可以写入指定的目录(听起来好像可以)。

让我知道这是否有帮助。

编辑:我的经验是使用 CRM 4.0,因此我会根据需要调整路径。

For plugins/workflow activities, your configuration file will be relative to the \Microsoft Dynamics CRM\Server\bin directory (assuming you're using a relative path). I use a single assembly for both the CRMWeb\bin and \Server\bin directories so I actually have two configuration files. One is at CRMWeb\ISV\MyISV\log4net.xml and the one for plugins/workflows is located at \Microsoft Dynamics CRM\Server\bin\ISV\MyISV\log4net.xml.

In my assemblyinfo.cs I have the following specification:

[assembly: log4net.Config.XmlConfigurator(ConfigFile = "ISV\MyISV\log4net.xml", Watch = true)]

Once you're sure that you're looking in the right place for your configuration file... If you're still having trouble with normal rolling files, set up an smtp appender to see if you get e-mails. I've found the I have very limited permissions running as plugins/workflows and don't have access to the file system. You'll want to make sure you can write to the specified directory (which it sounds like you can).

Let me know if this helps.

EDIT: My experience is with CRM 4.0, so I would adjust the paths as necessary.

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