added some logs

This commit is contained in:
Francesco Mangiacrapa 2024-10-17 11:18:03 +02:00
parent fc8b551249
commit b6e9fcddae
2 changed files with 8 additions and 0 deletions

View File

@ -65,8 +65,10 @@ public class GeoportalHealthCheck implements HealthCheck {
buildHCRProvider.setStatus(Status.UP); buildHCRProvider.setStatus(Status.UP);
MongoIterable<String> collections = mongo.getTheClient().getDatabase(mongo.getConnection().getDatabase()) MongoIterable<String> collections = mongo.getTheClient().getDatabase(mongo.getConnection().getDatabase())
.listCollectionNames(); .listCollectionNames();
log.info("listCollectionNames is null: {}", collections == null);
int i = 1; int i = 1;
for (String coll : collections) { for (String coll : collections) {
log.info("adding collection: {}", coll);
buildHCRProvider.withData("collection " + i, coll); buildHCRProvider.withData("collection " + i, coll);
i++; i++;
} }

View File

@ -7,6 +7,8 @@ import java.util.Optional;
import org.eclipse.microprofile.health.HealthCheckResponse; import org.eclipse.microprofile.health.HealthCheckResponse;
import org.eclipse.microprofile.health.HealthCheckResponse.Status; import org.eclipse.microprofile.health.HealthCheckResponse.Status;
import lombok.extern.slf4j.Slf4j;
/** /**
* The Class HealthCheckResponseGeoportalProvider. * The Class HealthCheckResponseGeoportalProvider.
* *
@ -14,6 +16,7 @@ import org.eclipse.microprofile.health.HealthCheckResponse.Status;
* *
* Oct 16, 2024 * Oct 16, 2024
*/ */
@Slf4j
public class HealthCheckResponseGeoportalProvider { public class HealthCheckResponseGeoportalProvider {
private String name; private String name;
@ -108,6 +111,9 @@ public class HealthCheckResponseGeoportalProvider {
public HealthCheckResponse buildHealthCheckResponse() { public HealthCheckResponse buildHealthCheckResponse() {
if (myMap != null) if (myMap != null)
data = Optional.of(myMap); data = Optional.of(myMap);
log.info("data are: "+data);
return new HealthCheckResponse(name, status, data); return new HealthCheckResponse(name, status, data);
} }