Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CsvHealthReporter does not output any logs #421

Open
mskidavid opened this issue Oct 11, 2023 · 1 comment
Open

CsvHealthReporter does not output any logs #421

mskidavid opened this issue Oct 11, 2023 · 1 comment
Assignees

Comments

@mskidavid
Copy link

We're seeing some missing data in the sink, and wanted to check if there are any errors being logged by Event Flow. I'm having trouble getting the CsvHealthReporter to write errors to a CSV file. The output CSV file does not even get created and I wanted to know how to proceed with debugging this scenario?

We're on .NET6, here's the example setup code we're using:

serviceCollection.AddOptions<CsvHealthReporterConfiguration>()
    .Configure<IConfiguration>((csvHealthReporterConfiguration, configuration) =>
    {
        configuration.GetSection("EventFlow").GetSection("HealthReporter").Bind(csvHealthReporterConfiguration);
    });

serviceCollection.AddSingleton<IHealthReporter>(
    sp => new CsvHealthReporter(
        sp.GetRequiredService<IOptions<CsvHealthReporterConfiguration>>().Value));

serviceCollection.AddSingleton<IGenevaUploader, AppServiceGenevaLogUploader>();
serviceCollection.AddSingleton<IMetricsLogger, GenevaMetricsLogger>();

// Create event flow
serviceCollection.AddSingleton<ITelemetryProcessorFactory>(sp =>
{
    var genevaUploader = sp.GetRequiredService<IGenevaUploader>();
    var healthReporter = sp.GetRequiredService<IHealthReporter>();
    var inputs = new IObservable<EventData>[] 
    { 
        new ApplicationInsightsInputFactory().CreateItem(null, healthReporter) 
    };
    var sinks = new[] { new EventSink(new GenevaOutputEventFlow(healthReporter, genevaUploader), null) };
    DiagnosticPipeline eventFlow = new DiagnosticPipeline(healthReporter, inputs, null, sinks);
    return new EventFlowTelemetryProcessorFactory(eventFlow);
});
@xiaomi7732 xiaomi7732 self-assigned this Oct 12, 2023
@xiaomi7732
Copy link
Member

Hey @mskidavid, what does the CsvHealthReporterConfiguration look like? Specifically, is there logFileFolder specified? And do you know does the app has permission to write to that folder?

That is interesting because according to this:

CsvHealthReporter will try to open the log file for writing during initialization. If it can't, by default, a debug message will be output to the debugger viewer like Visual Studio Output window, etc. This can happen especially if a value for the log file path is not provided (default is used, which is the application executables folder) and the application executables are residing on a read-only file system. Docker tools for Visual Studio use this configuration during debugging, so for containerized services the recommended practice is to specify the log file path explicitly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants