fluent / fluent/fluent-logger-java

Conflict with Spring cloud SpringApplication run

Abierto
#84 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Java
Estrellas
210
Forks
86
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Conflict with Spring cloud SpringApplication run. spring cloud because BootstrapApplicationListener.Causes Spring Application to execute many times.
and call **FluentLogger** stop. close sender, with sender is null.
then call `log(String tag, Map data, long timestamp) ` function Throw out NullPointerException?
in **FluentLoggerFactory** 58 line add this code?
```
public synchronized FluentLogger getLogger(String tagPrefix, String host, int port, int timeout, int bufferCapacity,
Reconnector reconnector) {
String key = String.format("%s_%s_%d_%d_%d", new Object[] { tagPrefix, host, port, timeout, bufferCapacity });

for (Map.Entry entry : loggers.entrySet()) {
if (entry.getValue().equals(key)) {
FluentLogger found = entry.getKey();
if(found != null) {
if(found.getSender() == null){
found.setSender(getNewSender(host, port, timeout, bufferCapacity, reconnector));
}
return found;
}
break;
}
}

FluentLogger logger = new FluentLogger(tagPrefix, getNewSender(host, port, timeout, bufferCapacity, reconnector));
loggers.put(logger, key);
return logger;
}

private Sender getNewSender( String host, int port, int timeout, int bufferCapacity, Reconnector reconnector){
Sender sender = null;
Properties props = System.getProperties();
if (!props.containsKey(Config.FLUENT_SENDER_CLASS)) {
// create default sender object
sender = new RawSocketSender(host, port, timeout, bufferCapacity, reconnector);
} else {
String senderClassName = props.getProperty(Config.FLUENT_SENDER_CLASS);
try {
sender = createSenderInstance(senderClassName, new Object[] { host, port, timeout, bufferCapacity });
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return sender;
}
```

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Start with FluentLoggerFactory around line 58 and inspect how FluentLogger sender lifecycle interacts with SpringApplication and BootstrapApplicationListener. Reproduce the NullPointerException in log(String tag, Map data, long timestamp), then add coverage for the null-sender case; done means repeated application startup no longer causes the failure.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
java
Área
observability
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.