Asp. The design of operation log of net full stack development log module

Source: Internet
Author: User

The logs in the application are broadly divided into three types

First: The Exception Log for the bug in production mode. (This kind of diary is believed that everybody understands)

Second: The behavior log used to record important operations. (This kind of log main function is traceable, the behavior mainly has three kinds: increases, deletes, changes)

The third type: The message log used to record the history browsing. (This type of log mainly records the user's browsing traces)

The message log and the behavior log are somewhat similar and have a traceable effect, but they are distinct.

The message log records all operational information, such as "GXQSD logged into the system 2018-7-27 23:46:10", "GXQSD visited the User Management home page", "GXQSD view liming Personal Information", in short he is more like a word, also like a browsing record, we for each A message log stores a URL that can be traced back in turn. (So the message log does not contain operations on the data, which belongs to the behavior log)

The behavior log is mainly to record data changes, such as "GXQSD new role" This time triggered the new action, we want to record this behavior, if it is only recorded "Gxqsd a new role" that obviously he is a bit like the message log, but it can not be used for historical records. So the most important thing to do as a behavior log is to record the changes in the data. So there's a new role for GXQSD, and the right approach should be to store the new role entity information.

Next, a simple diagram is used to describe the relationship between database tables.

We define a log record table logging, where each row of data represents a behavior log. Using logdatadetial to represent the details of a behavior log

Where Targetid in the logging table represents the target object of the entity operation, such as "GXQSD Create a new user" TableName is "user" and Targetid represents the ID of the new user, Through table and Targetid we can eventually locate specific entities in the retrospective.

Logdatadetail table is very simple, logging represents each behavior log, and each behavior log changes the data is in the entity, the entity has more than one field, in order to be able to trace the change of the Entity data in detail, Logdatadetail decomposes each attribute of an entity into a form that resembles a key-value pair. They are also associated with specific behavior logs through Logid. Each of the logging is associated with the operator user.

Asp. The design of operation log of net full stack development log module

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.