Adding Exception to Logger , and update batch jobs status as well (#8217)

This commit is contained in:
Mohit Yadav 2022-10-18 18:59:11 +05:30 committed by GitHub
parent ee2aa29afc
commit 7af8c5418c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,6 +31,7 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;
import javax.ws.rs.core.UriInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.bulk.BackoffPolicy;
import org.elasticsearch.action.bulk.BulkProcessor;
@ -296,7 +297,13 @@ public class BuildSearchIndexResource {
after = result.getPaging().getAfter();
} while (after != null);
} catch (Exception ex) {
LOG.error("Failed in listing all Entities of type : {}", entityType);
LOG.error("Failed in listing all Entities of type : {}, Reason : ", entityType, ex);
FailureDetails failureDetails =
new FailureDetails()
.withContext(String.format("%s:Failure in fetching Data", entityType))
.withLastFailedReason(
String.format("Failed in listing all Entities \n Reason : %s", ExceptionUtils.getStackTrace(ex)));
listener.updateElasticSearchStatus(EventPublisherJob.Status.IDLE, failureDetails, null);
}
}
@ -332,7 +339,7 @@ public class BuildSearchIndexResource {
after = result.getPaging().getAfter();
} while (after != null);
} catch (Exception ex) {
LOG.error("Failed in listing all Entities of type : {}", entityType);
LOG.error("Failed in listing all Entities of type : {}, Reason {}", entityType, ex);
}
}