added more logs

This commit is contained in:
Francesco Mangiacrapa 2024-10-21 15:13:54 +02:00
parent 3b208b450e
commit a4611b887a
3 changed files with 3 additions and 29 deletions

View File

@ -1,17 +0,0 @@
//package org.gcube.application.geoportal.service;
//
//import javax.ws.rs.ApplicationPath;
//
//import org.gcube.application.geoportal.service.rest.GeoportalHealth;
//import org.glassfish.jersey.server.ResourceConfig;
//
//@ApplicationPath("/")
//public class GeoPortalServiceHealth extends ResourceConfig {
//
// public GeoPortalServiceHealth() {
//
// registerClasses(GeoportalHealth.class);
//
// }
//
//}

View File

@ -32,6 +32,7 @@ public class MongoHealthCheck implements HealthCheck {
} }
private HealthCheckResponse checkMongo(String context) { private HealthCheckResponse checkMongo(String context) {
log.debug("checkMongo in the context: {}", context);
HealthCheckResponseBuilder buildHCRBuilder = HealthCheckResponse.named(SERVICE_NAME); HealthCheckResponseBuilder buildHCRBuilder = HealthCheckResponse.named(SERVICE_NAME);
Mongo mongo = null; Mongo mongo = null;
try { try {
@ -39,6 +40,7 @@ public class MongoHealthCheck implements HealthCheck {
mongo = ImplementationProvider.get().getProvidedObjectByClass(Mongo.class); mongo = ImplementationProvider.get().getProvidedObjectByClass(Mongo.class);
buildHCRBuilder = appendMongoInfo(buildHCRBuilder, mongo.getConnection()); buildHCRBuilder = appendMongoInfo(buildHCRBuilder, mongo.getConnection());
buildHCRBuilder.state(true); buildHCRBuilder.state(true);
log.info("checkMongo is OK in the context: {}", context);
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); log.info("listCollectionNames is null: {}", collections == null);
@ -50,6 +52,7 @@ public class MongoHealthCheck implements HealthCheck {
} }
return buildHCRBuilder.build(); return buildHCRBuilder.build();
} catch (Exception e) { } catch (Exception e) {
log.info("checkMongo is KO in the context: {}", context);
buildHCRBuilder.state(false); buildHCRBuilder.state(false);
if (mongo != null) { if (mongo != null) {
MongoConnection connection = null; MongoConnection connection = null;

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<application mode='online'>
<name>${project.artifactId}</name>
<group>${project.groupId}</group>
<version>${project.version}</version>
<description>${project.description}</description>
<!-- <exclude>/srv/docs/*</exclude> -->
<!-- <exclude>/srv/api-docs/*</exclude> -->
<exclude>/src/health</exclude>
</application>