Base solution for your next web application
Open Closed

AuditInfo save logs with custom properties #143


User avatar
0
hans abelshausen created

Hi, I wanna add some custom properties to the database table AbpAuditLogs. I have added a class:

public class Log : AuditLog
    {
        public int ActionContextId { get; set; }
        public UserAction UserAction { get; set; }
        public ActionType ActionType { get; set; }
        public Actioncontexttype Actioncontexttype { get; set; }
        public string ActionContextText { get; set; }
    }

I published the new fields to the database.

Now in my application library I try to save the auditInfo and the new fields, but I'm not sure how to do it.

For example, I delete a field in my application and now I wanna log this. If I use the original logging, the methodname parameters etc are saved. How can I add my properties to the save procedure?


1 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    There is no way of extending AuditLog for now. But surely you can derive from AuditLog, create and save it manually injecting and using IRepository<YOUR_AUDIT_LOG_CLASS>.

    Also, you can implement a special security logging system for your needs in addition to automatic audit logging. Since it's automatic, it's limited.