Base solution for your next web application
Open Closed

Custom data in AbpAuditLogs #1966


User avatar
0
georgebollas created

I am looking for a way to use the CustomData field in AbpAuditLogs. What is the correct way to add data to this field?

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

3 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You can create a custom AuditInfoProvider which derives from DefaultAuditInfoProvider. <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/blob/a706b7e8f497a4afe2bb746892fd6c010b0875fc/src/Abp/Auditing/NullAuditInfoProvider.cs">https://github.com/aspnetboilerplate/as ... rovider.cs</a>.

    Then you need to replace default implementation with yours in the PreInitialize method of your module.

    Configuration.ReplaceService<IAuditInfoProvider, MyCustomAuditInfoProvider>();
    
    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    georgebollas created

    thanks, I got that far. However, How do I hook into the Fill call to set the CustomData field?

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I couldn't understand your problem. When you create a new class, lets say MyCustomAuditInfoProvider, and use replace service for IAuditInfoProvider, ABP will automatically call your new MyCustomAuditInfoProvider's Fill method instead of it's default IAuditInfoProvider implementation.

    If this is not the case for you, can you explaint it a bit more detailed.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)