@@ -100,16 +100,9 @@ public void ready(SneakyThrows.Consumer2<WebClient, WebClient> onReady) {
100100 if (mavenBuild ) {
101101 applogger = app .getClass ().getName ();
102102 app .setStartupSummary (List .of (StartupSummary .NONE ));
103- if (app .getErrorHandler () == null ) {
104- app .error (
105- new DefaultErrorHandler () {
106- @ Override
107- protected void log (Context ctx , Throwable cause , StatusCode code ) {
108- app .getLog ()
109- .info (ErrorHandler .errorMessage (ctx , code ) + ": " + cause .getMessage ());
110- }
111- });
112- }
103+ app .error (
104+ Optional .ofNullable (app .getErrorHandler ())
105+ .orElseGet (ServerTestRunner ::buildErrorHandler ));
113106 }
114107
115108 ServerOptions serverOptions = app .getServerOptions ();
@@ -154,6 +147,18 @@ protected void log(Context ctx, Throwable cause, StatusCode code) {
154147 }
155148 }
156149
150+ private static DefaultErrorHandler buildErrorHandler () {
151+ return new DefaultErrorHandler () {
152+ @ Override
153+ protected void log (Context ctx , Throwable cause , StatusCode code ) {
154+ ctx .getRouter ()
155+ .getLog ()
156+ .info (ErrorHandler .errorMessage (ctx , code ) + ": " + cause .getMessage ());
157+ ctx .getRouter ().getLog ().debug (ErrorHandler .errorMessage (ctx , code ), cause .getMessage ());
158+ }
159+ };
160+ }
161+
157162 private boolean disabled () {
158163 var osname = System .getProperty ("os.name" ).toLowerCase ();
159164 var osarch = System .getProperty ("os.arch" ).toLowerCase ();
0 commit comments