使用 Elmah 审计有趣的事件
我可以连接 Elmah 以在 ASP.Net 应用程序中记录异常,并且效果很好。
我还需要审核应用程序中发生的有趣事件。 例如,我必须审核“电子邮件地址已更改”事件并存储新旧电子邮件地址。
使用 Elmah 记录这些有趣的事件是否合适? Elmah 似乎没有配置为记录异常之外的任何内容。
我可以把它压在那里并创建一个假异常,但这闻起来很有趣。 另一方面,对于一个小型应用程序来说,拥有多个日志存储库似乎很糟糕。
使用 Elmah 作为审计存储库并创建虚假异常是否合适? 除了例外情况外,Elmah 还可以存储“信息”项吗? 当我已经在使用 Elmah 时,是否有更好的有趣事件存储库?
I can wire up Elmah to log Exceptions in my ASP.Net application and it works well.
I also have a requirement to audit interesting events that occur in the application. For example, I must audit the "email address was changed" event and store the old and new email address.
Is it appropriate to use Elmah to log these interesting events? It doesn't seem like Elmah is configured to log anything beyond exceptions.
I could smush it in there and create a fake Exception, but that smells funny. On the other hand, it seems bad to have multiple log repositories laying around for a small application.
Is it appropriate to use Elmah as an audit repository and create fake exceptions?
Can Elmah store "info" items, in addition to exceptions?
Is there a better repository for interesting events when I'm already using Elmah?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
绝对不要使用 ELMAH 进行审计。 要么将审核构建到您的业务逻辑中,要么至少使用 log4net 之类的东西将其记录在其他地方。
Definitely don't use ELMAH for auditing. Either build auditing into your business logic or at the very least use something like log4net to log it somewhere else.
我想我可能会在你想要审计的字段上创建一个sql触发器,这样你就不会与任何其他应用程序搞混了,SQL Server会为你处理这一切
I think i'd probably create a sql trigger on the fields you are wanting to audit, you wont have mess about with any other applications then, SQL server will just take care of it all for you
翻旧帖,但现在有了 log4net 的 elmahappender
这样,您就可以拥有以下功能的所有功能log4net,就像向 elmah 发送信息消息一样,并且有 elmah 漂亮的 Web 界面来读取它们。
Bumping an old post, but now there's an elmahappender for log4net
This way, you can have all the functionality of log4net, like sending info messages to elmah, and have the nice web interface of elmah to read them.