Base solution for your next web application
Open Closed

how to log only Exceptions in abpAuditLog #2500


User avatar
0
razieh69 created

Hello,

I Enable AuditLog in my project, but i want to save only Exceptions in abpAuditLog Table. Beacuse the number of rows is too high and my database grows very fast.

how can i do this?

please help me :cry: :cry:


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

    Hi,

    There is no built in setting for this but you can create a custom implementation for IAuditingStore just like this one <a class="postlink" href="https://github.com/aspnetboilerplate/module-zero/blob/09cb578f09ee0318b479aa31dd0ceff56a5d218d/src/Abp.Zero/Auditing/AuditingStore.cs">https://github.com/aspnetboilerplate/mo ... ngStore.cs</a>.

    Check before saving audit log if auditInfo.Exception is not null.

    You need to replace existing implementation with your version in your web module's PreInitialize method like this.

    Configuration.ReplaceService<IAuditingStore, YourCustomAuditingStore>