Skip to content

Commit 7f0c1a6

Browse files
committed
pass in a logger factory
1 parent 6689cdc commit 7f0c1a6

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/main/java/io/fusionauth/http/server/DefaultHTTPUnexpectedExceptionHandler.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package io.fusionauth.http.server;
1717

1818
import io.fusionauth.http.log.Logger;
19+
import io.fusionauth.http.log.LoggerFactory;
1920

2021
/**
2122
* THe default HTTP unexpected exception handler.
@@ -25,8 +26,9 @@
2526
public class DefaultHTTPUnexpectedExceptionHandler implements HTTPUnexpectedExceptionHandler {
2627

2728
@Override
28-
public int handle(Logger logger, Throwable t) {
29+
public int handle(LoggerFactory loggerFactory, Throwable t) {
2930
int internalServerError = 500;
31+
Logger logger = loggerFactory.getLogger(DefaultHTTPUnexpectedExceptionHandler.class);
3032
logger.error(String.format("[%s] Closing socket with status [%d]. An HTTP worker threw an exception while processing a request.", Thread.currentThread().threadId(), internalServerError), t);
3133
return internalServerError;
3234
}

src/main/java/io/fusionauth/http/server/HTTPUnexpectedExceptionHandler.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
package io.fusionauth.http.server;
1717

18-
import io.fusionauth.http.log.Logger;
18+
import io.fusionauth.http.log.LoggerFactory;
1919

2020
/**
2121
* An interface defining the HTTP unexpected exception handler contract.
@@ -30,9 +30,9 @@ public interface HTTPUnexpectedExceptionHandler {
3030
* The intent is that this provides additional flexibility on the status code and the logging behavior when an unexpected exception
3131
* caught.
3232
*
33-
* @param logger the HTTP worker logger.
34-
* @param t the unexpected exception to handle.
33+
* @param loggerFactory the configured logger factory.
34+
* @param t the unexpected exception to handle.
3535
* @return the desired HTTP status code. Note that if the response has already been committed this will be ignored.
3636
*/
37-
int handle(Logger logger, Throwable t);
37+
int handle(LoggerFactory loggerFactory, Throwable t);
3838
}

0 commit comments

Comments
 (0)