log4net appenders never flush their client, so events are lost at shutdown
Mantenedores costumam responder em até 6 dias
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 78/100
Direção de pesquisa
Leia ExceptionlessAppender.cs e BufferingExceptionlessAppender.cs nos locais vinculados e, em seguida, compare o tratamento do encerramento com ExceptionlessTarget.cs. Acompanhe como cada appender cria seu cliente e como o fechamento do buffer envia os eventos; considera-se concluído quando o fechamento ou a liberação processa os eventos na fila dentro do tempo limite e descarta somente um cliente criado pelo appender.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
In Exceptionless.Log4net 6.2.0, when ApiKey or ServerUrl is set on ExceptionlessAppender or BufferingExceptionlessAppender, the appender creates its own ExceptionlessClient with in-memory storage. Nothing ever processes that client's queue on close or flush, so events logged shortly before the process exits are never sent.
Where
- https://github.com/exceptionless/Exceptionless.Net/blob/5792f00d175f94a35fe0559c8e9999234a8163be/src/Platforms/Exceptionless.Log4net/ExceptionlessAppender.cs#L12-L27
- https://github.com/exceptionless/Exceptionless.Net/blob/5792f00d175f94a35fe0559c8e9999234a8163be/src/Platforms/Exceptionless.Log4net/BufferingExceptionlessAppender.cs#L17-L34
For comparison, the NLog target flushes its client: https://github.com/exceptionless/Exceptionless.Net/blob/5792f00d175f94a35fe0559c8e9999234a8163be/src/Platforms/Exceptionless.NLog/ExceptionlessTarget.cs#L96-L98
What happens
- The private client is never started, so it does not register the process-exit handler that
Startup()registers for other clients. - Neither appender overrides
OnCloseorFlush, soLogManager.Shutdown()/LogManager.Flush()do not send queued events. - The queue is only processed by the client's timer (first run after 2 seconds, then every 10 seconds). Events logged in the last few seconds before exit stay in memory and are lost. For
BufferingExceptionlessAppender, the buffer is handed to the client on close, but the client's queue is still never sent. - The client is never disposed either.
Expected
Closing or flushing the appender (for example LogManager.Shutdown()) sends the queued events, and the appender disposes a client it created.
Steps to reproduce
- Configure
ExceptionlessAppenderin log4net with<apiKey value="..." />. - In a console app, log an error and then call
LogManager.Shutdown()and exit. - The event never arrives in Exceptionless.
Suggested fix
In both appenders, override OnClose (calling the base first for the buffering appender so the buffer is submitted) and Flush(int millisecondsTimeout) to call _client.ProcessQueueAsync() and wait up to the timeout, and dispose the client in OnClose when the appender created it.
- Linguagem predominante
- C#
- Estrelas
- 573
- Forks
- 143
- Merge médio
- 5d 9h
- PRs com merge (30d)
- 1
Preparar o ambiente
Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de exceptionless/Exceptionless.Net
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 86/100
exceptionless/Exceptionless.Net#391 ·
Mantenedores costumam responder em até 6 dias
-
bug
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 88/100
exceptionless/Exceptionless.Net#387 ·
Mantenedores costumam responder em até 6 dias
-
AWS Lambda detection never matches because the environment variable name has a trailing spaceAbertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
exceptionless/Exceptionless.Net#386 ·
Mantenedores costumam responder em até 6 dias
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 35/100
exceptionless/Exceptionless.Net#389 ·
Mantenedores costumam responder em até 6 dias
-
bug
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 72/100
exceptionless/Exceptionless.Net#388 ·
Mantenedores costumam responder em até 6 dias
Todas as issues de exceptionless/Exceptionless.Net
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
-
area: core priority: low type: bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
RicoSuter/Namotion.Interceptor#863 ·
Mantenedores costumam responder em até 1 dia
-
area-cli
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia
-
0.3.0
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 86/100
Mantenedores costumam responder em até 2 dias