diff --git a/openbas-api/src/main/java/io/openbas/rest/collector_frontend_error/LogApi.java b/openbas-api/src/main/java/io/openbas/rest/collector_frontend_error/LogApi.java index 83a081081a..a700df3990 100644 --- a/openbas-api/src/main/java/io/openbas/rest/collector_frontend_error/LogApi.java +++ b/openbas-api/src/main/java/io/openbas/rest/collector_frontend_error/LogApi.java @@ -15,6 +15,10 @@ public class LogApi extends RestBehavior { @PostMapping("/api/logs/frontend-error") public void logError(@RequestBody ErrorDetailsInput errorDetails) { - logger.error("Error received: " + errorDetails); + logger.error( + "Message error received: {} stacktrace: {} at {}", + errorDetails.getMessage(), + errorDetails.getStack(), + errorDetails.getTimestamp()); } } diff --git a/openbas-front/src/utils/Action.ts b/openbas-front/src/utils/Action.ts index 312cbf5c74..800703662d 100644 --- a/openbas-front/src/utils/Action.ts +++ b/openbas-front/src/utils/Action.ts @@ -214,7 +214,7 @@ export const bulkDeleteReferential = (uri: string, type: string, data: unknown) export const sendErrorToBackend = async (error: Error, stack: ErrorInfo) => { const errorDetails = { message: error.message, - stack: stack, + stack: stack.componentStack, timestamp: new Date().toISOString(), }; simplePostCall('/api/logs/frontend-error', errorDetails)