Hello When inserting data in about 60 different columns, when I go to the Audit Log page, and try to see the details. I have a JavaScript error "0x800a03f6 - JavaScript runtime error: Invalid character"
I see on the database the parameter information is truncated and terminated with "..."
{"resultadoBack":{"productDataId":0,.................,more parameters in the middle.............................,"text31":null,"text32":n**...**
Any idea how to save all the parameters to the audit log table, then avoid having that JavaScript error while displaying details?
At first I need to change the default 1024 PARAMETERS FIELD length to nvarchar(max) for the AUDITLOG entity but that Entity class is compiled on the abp.zero dll.
Thank you very much !!!
5 Answer(s)
-
0
Hi @SergioP,
You can change size of that field like this in onModelCreating of your DbContext:
modelBuilder.Entity<AuditLog>().Property(p => p.Parameters).HasMaxLength(4000);
Thanks.
-
0
Oh Great, thank you !!!
Additional question I have now the table now to nvarchar(max) but the parameter is still truncated at 1024, I've reviewd all the code related to AdutiLogs but I could not find where to chang the way the parameter is created and saved to DB. My idea is to remove that 1024 character limitation on the audit log parameter.
Finally I see you are truncating and adding "..." on the same entity on Module zero I've modified MaxParametersLengthin the Module Zero Project, and recompiled the dll, the parameter field in audit log displays all the data now.
But if you have in mind a way to do that, without touching the Module Zero code, it will be appreciated, I prefer to restore the original module zero dll, and just change code in ASPNET ZERO. Any whelp will be appreciated, Thank you
-
0
hi
you shouldn't modify Module Zero code. basically this will help you
protected override void OnModelCreating(ModelBuilder modelBuilder) { AuditLog.MaxParametersLength = 4000; //other fields... base.OnModelCreating(modelBuilder); //... }
<a class="postlink" href="https://github.com/aspnetboilerplate/module-zero/issues/352#issuecomment-302617520">https://github.com/aspnetboilerplate/mo ... -302617520</a>
-
0
Thank you, It seems it is declared as constant in module zero. then can not be modified. Regards
-
0
Thanks for your feedback ;)