Base solution for your next web application
Open Closed

AuditingInterceptor logs ReturnValue when running Unit Tests but does not when calling from Angular Front-End or Swagger #7914


User avatar
0
OriAssurant created

Hi Abp Zero Support,

Our project is Angular 8 + Core 2. I turned on Configuration.Auditing.SaveReturnValues = true; in ProjectCoreModule.PreInitialize().

And here are all customization I've done, in which ILoggedServices is an interface to turn on custom logging for some domain services.

Configuration.ReplaceService<IAuditingHelper, AuditingHelperExtension>();
Configuration.Auditing.IsEnabledForAnonymousUsers = true;
Configuration.Auditing.SaveReturnValues = true;
Configuration.Auditing.Selectors.Add(
    new NamedTypeSelector(
        "ILoggedServices",
        type => typeof(ILoggedServices).IsAssignableFrom(type)
    )
);

Btw, I added some custom interceptors as well:

Configuration.IocManager.IocContainer.Register(
    Component.For<IOfferServiceIntegration>().ImplementedBy<OfferServiceIntegration>()
        .Interceptors<OfferServiceInterceptor>()
        .LifestyleTransient()
);

Then I ran unit tests, and saw Return Values are properly logged. But when I ran from swagger or frontend, Return Values are always null. Do I miss anything?

Thank you,


1 Answer(s)