Skip to content

Commit

Permalink
Merge pull request #8 from gtn1024/log
Browse files Browse the repository at this point in the history
将 printStackTrace 改为日志框架 log
  • Loading branch information
aruis authored Jul 25, 2024
2 parents b219f91 + 63d42c6 commit c8043f4
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@
import jakarta.ws.rs.ext.ExceptionMapper;
import jakarta.ws.rs.ext.Provider;
import net.ximatai.muyun.core.ServerConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Provider
public class GlobalExceptionHandler implements ExceptionMapper<Exception> {

private final Logger logger = LoggerFactory.getLogger(GlobalExceptionHandler.class);

@Inject
ServerConfig config;

@Override
public Response toResponse(Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);

return Response
.status(Response.Status.INTERNAL_SERVER_ERROR)
Expand Down

0 comments on commit c8043f4

Please sign in to comment.