abp icon indicating copy to clipboard operation
abp copied to clipboard

it does not log // are there any friends who can help

Open md-yilmaz opened this issue 4 years ago • 9 comments

Hello Friends, my presentation layer (Web) is as follows 57 and 61. even though I added the logging code between the lines, it doesn't log. dec does not log.

I have the same problem in another project that is also installed on Github link: https://github.com/md-yilmaz/Audit/blob/320d937b6b0d86773f516f6154beb37f2ba4a3ab/src/Sample.Blazor/SampleBlazorModule.cs#L97-L101

I would like to ask you to make the relevant changes to the project on Github, thank you in advance for your help. Good work to everyone

public override void ConfigureServices(ServiceConfigurationContext context)
{
    var hostingEnvironment = context.Services.GetHostingEnvironment();
    var configuration = context.Services.GetConfiguration();

    ConfigureUrls(configuration);
    ConfigureBundles();
    ConfigureAuthentication(context, configuration);
    ConfigureAutoMapper();
    ConfigureVirtualFileSystem(hostingEnvironment);
    ConfigureLocalizationServices();
    ConfigureSwaggerServices(context.Services);
    ConfigureAutoApiControllers();
    ConfigureBlazorise(context);
    ConfigureRouter(context);
    ConfigureMenu(context);
    
    Configure<AbpAuditingOptions>(options =>
    {
        options.IsEnabled = true;
        options.EntityHistorySelectors.AddAllEntities();
    });
}

md-yilmaz avatar Mar 23 '22 07:03 md-yilmaz

Do you add the UseAuditing middleware?

https://docs.abp.io/en/abp/latest/Audit-Logging#useauditing

maliming avatar Mar 23 '22 09:03 maliming

Hello Master, it doesn't log#12055, thank you for your answer to the transaction.

I've already reviewed the link you sent many times, I've already done it according to it, but I'm probably missing somewhere, so it doesn't log in, even I put the github project link.

I would like you to help me solve this problem. Syg.

md-yilmaz avatar Mar 23 '22 09:03 md-yilmaz

are there any friends who can help

md-yilmaz avatar Mar 23 '22 19:03 md-yilmaz

I have the same problem with the blazor-server. Abp blazor-server couldn't log with UI but if you trigger API on swagger it is logging.

BarisGurbuz avatar Mar 23 '22 19:03 BarisGurbuz

I've done it before. I started the project directly, not in the swagger, and saved it in the diary there. Now I'm writing the same code in the same place it doesn't.

md-yilmaz avatar Mar 23 '22 19:03 md-yilmaz

Maybe related to https://github.com/abpframework/abp/issues/11682

maliming avatar Mar 24 '22 02:03 maliming

i tried my master, but it didn't happen

in the order of my actions 1-dotnet tool update -g Vol.Abp.Cli 2-abp update -n 5.2.0-rc.2

i am sending it in 2 classes at the presentation layer.

public override void ConfigureServices(ServiceConfigurationContext context)
{
    var hostingEnvironment = context.Services.GetHostingEnvironment();
    var configuration = context.Services.GetConfiguration();

    ConfigureUrls(configuration);
    ConfigureBundles();
    ConfigureAuthentication(context, configuration);
    ConfigureAutoMapper();
    ConfigureVirtualFileSystem(hostingEnvironment);
    ConfigureLocalizationServices();
    ConfigureSwaggerServices(context.Services);
    ConfigureAutoApiControllers();
    ConfigureBlazorise(context);
    ConfigureRouter(context);
    ConfigureMenu(context);
    
    **Configure<AbpAuditingOptions>(options =>
    {
        options.IsEnabled = true;
        options.EntityHistorySelectors.AddAllEntities();
    });**
}

and

public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
    var env = context.GetEnvironment();
    var app = context.GetApplicationBuilder();

    app.UseAbpRequestLocalization();

    if (env.IsDevelopment())
    {
        app.UseDeveloperExceptionPage();
    }
    else
    {
        app.UseExceptionHandler("/Error");
        app.UseHsts();
    }

    app.UseHttpsRedirection();
    app.UseCorrelationId();
    app.UseStaticFiles();
    app.UseRouting();
    app.UseAuthentication();
    app.UseJwtTokenMiddleware();

    if (MultiTenancyConsts.IsEnabled)
    {
        app.UseMultiTenancy();
    }
    app.UseUnitOfWork();
    app.UseIdentityServer();
    app.UseAuthorization();
    app.UseSwagger();
    app.UseAbpSwaggerUI(options =>
    {
        options.SwaggerEndpoint("/swagger/v1/swagger.json", "Sample API");
    });
    **app.UseAuditing();**
    app.UseConfiguredEndpoints();
}

the result is still not logging, I looked at the logs file with the extension txt to understand that there is no logging. You can also *SELECT FROM [ab].[dbo].I said [AbpEntityPropertyChanges] there are no lines at all. I would ask for your help.

md-yilmaz avatar Mar 24 '22 08:03 md-yilmaz

@maliming I have made a few tests and this seems to be related to Blazor.Server only.

In my tests on Blazor.Server, audit logs are not saved to the database. When the page is refreshed, changes can be seen to happen to the database. And sometimes this doesn't occur as well.

Audit logging persistence (especially EntityChanges) on the database seems very inconsistent.

This does seem familiar with #11682. Feel free to merge the issues if you think they are the same.

gterdem avatar Mar 24 '22 11:03 gterdem

Move to https://github.com/abpframework/abp/issues/11682

maliming avatar Mar 25 '22 01:03 maliming