serilog-sinks-azureblobstorage icon indicating copy to clipboard operation
serilog-sinks-azureblobstorage copied to clipboard

Call to log writer never returns in Blazor application (from Issue #32)

Open GCoding83 opened this issue 4 years ago • 6 comments

Hi,

A problem was raised at the end of Issue #32, which was closed because it initially concerned only pre-.NET Standard 2.0 applications. The very same problem arises in Blazor applications. The application stops reading logs after the first line read, and it then loads endlessly. Help would be greatly appreciated.

GCoding83 avatar Jan 26 '21 18:01 GCoding83

I can't foresee a time when I'd have the availability to debug into what's happening with Blazor applications. I'm sorry it's not working for you, but given that there is source available here, please post what you find when look into it.

More to the point, it's super easy to submit a pull request, so I'd urge you to consider that.

chriswill avatar Jan 26 '21 18:01 chriswill

Thanks for the quick reply Chris. I totally understand what you're saying. No worries at all.

Just a quick clarification if you don't mind. You wrote "I'm sorry it's not working for you". To your knowledge, does the Sink work on Blazor for other people?

GCoding83 avatar Jan 26 '21 18:01 GCoding83

Unfortunately I've never heard of any feedback, one way or the other, from Blazor developers.

chriswill avatar Jan 26 '21 19:01 chriswill

Got it thanks. Not sure I'll find the time to work on this myself. If someone else out there can find the time, that would be great. In the meantime, I'll just use the File Sink.

GCoding83 avatar Jan 26 '21 19:01 GCoding83

Out of the box, it does not work for me in .Net 6 w/ Blazor Server. It seems to interfere with either Microsoft.Identity.Web or SignalR. The sink will write some data to the blob but the Blazor application just sits and spins.

Removing the reference to WriteTo.AzureBlobStorage and the application works just fine...

Using the Install-Package Serilog.Sinks.Async resolves the issue:

.WriteTo.Async(a=> a.AzureBlobStorage(
                            "<<connectionstring>>",
                            Serilog.Events.LogEventLevel.Information,
                            "logs",
                            "{yyyy}/{MM}/{dd}/{yyyy}-{MM}-{dd}_{HH}.txt"
                ))

jassent avatar Aug 29 '22 18:08 jassent

I have the same problem. .NET 8 Blazor Server It seems to occur when writeInBatches is set to false. When it is set to true, I haven't tested it much yet, but so far, it appears to be working correctly.

dalian-spacekey avatar Dec 05 '23 04:12 dalian-spacekey

I don't think I have any plans on testing in the Blazor environment, so closing for now

chriswill avatar Jul 17 '24 21:07 chriswill