log4net appenders never flush their client, so events are lost at shutdown
Los mantenedores suelen responder en 6 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
Línea de trabajo
Lee ExceptionlessAppender.cs y BufferingExceptionlessAppender.cs en las ubicaciones enlazadas y luego compara el manejo del cierre con ExceptionlessTarget.cs. Sigue cómo cada appender crea su cliente y cómo el cierre del búfer envía los eventos; se considera terminado cuando el cierre o el vaciado procesa los eventos en cola dentro del tiempo límite y libera solo un cliente creado por el appender.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- C#
- Estrellas
- 573
- Forks
- 143
- Merge medio
- 5 d 9 h
- PR fusionados (30 d)
- 1
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de exceptionless/Exceptionless.Net
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
exceptionless/Exceptionless.Net#391 ·
Los mantenedores suelen responder en 6 días
-
bug
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
exceptionless/Exceptionless.Net#387 ·
Los mantenedores suelen responder en 6 días
-
AWS Lambda detection never matches because the environment variable name has a trailing spaceAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
exceptionless/Exceptionless.Net#386 ·
Los mantenedores suelen responder en 6 días
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 35/100
exceptionless/Exceptionless.Net#389 ·
Los mantenedores suelen responder en 6 días
-
bug
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
exceptionless/Exceptionless.Net#388 ·
Los mantenedores suelen responder en 6 días
Todos los issues de exceptionless/Exceptionless.Net
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
area: core priority: low type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
RicoSuter/Namotion.Interceptor#863 ·
Los mantenedores suelen responder en 1 día
-
area-cli
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
0.3.0
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
Los mantenedores suelen responder en 2 días