如何创建会话日志 [英] How do I create Session Logs

查看:61
本文介绍了如何创建会话日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。我目前正在为学校项目开发患者管理系统。我被要求包括管理员和用户的日志,以跟踪他们在系统中的活动。我不知道从哪里开始。有人可以帮帮我吗? Tnx

Hi. I am currently developing a patient management system for a school project. I was asked to include logs for both admin and users to keep track of their activities in the system. I don't know where to start. Can somebody here help me? Tnx

推荐答案

通常,当用户执行某些操作时,操作的详细信息将保存在存储库中。这个存储库可以是文件,事件日志或数据库表。



在您的情况下,您可以选择适合的存储库(我将在此回复中使用数据库作为存储库)你最好的。如果您的目标是在屏幕上显示日志,请使用数据库表。



数据库表通常如下所示:



In general, when a user does some action, the details of action is saved in a repository. This repository could be file, event logs or database table.

In your case, you can choose a repository (I will use database as repository in this reply) that suits you best. If your aim is to display logs on screen, use a database table.

The database table would generally look like:

Logs
        LogId
        Action
        UserId
        DateTime
        Details





现在,假设创建了一个新的患者记录,在这种情况下,您可以在此表中添加记录,其中包括创建记录的操作,创建记录的用户的用户ID,创建的日期和时间以及其他详细信息如果需要。



这类表通常用于记录应用程序中可能发生的错误,或者如果要保留整个审计跟踪(使用的术语)用于活动跟踪和日志)。这样,您就可以跟踪可能发生的所有编辑/更新。



如果您只关心最新更新,可以为<$添加字段c $ c> LastUpdatedBy 和 LastUpdatedDate 并保留详细信息。



有大量有助于设置日志记录的框架。看看Microsoft Enterprise库。它会让你的事情变得更轻松。但是,我会建议您自己做所有事情,因为它会帮助您更好地学习。



尝试自己实施日志记录,如果遇到问题,请回答具体问题。确保您在问题中共享相关代码。不要在这里要求代码。这不是CodeProject的工作方式。



Now, say a new patient record is created, in that case you can add a record in this table with action as record created, userid of user who created record, date and time of creation and other details if needed.

These kind of tables are generally used to log errors that may have occurred in the application or if you want to keep entire audit trail (term used for activity tracking and logs). This way, you can keep track of all the edits/updates that may have happened.

If you are only concerned with latest update, you can add fields for LastUpdatedBy and LastUpdatedDate and keep details there.

There are plenty of frameworks that help with setting up logging. Take a look at Microsoft Enterprise library. It will make things easier for you. However, I will recommend doing everything on your own as it will help you learn better.

Try to implement logging yourself and if you get stuck, come back with specific question. Make sure that you share relevant code in the question. Do not ask for code here. It is not the way CodeProject works.


这篇关于如何创建会话日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆