@@ -293,7 +293,7 @@ protected static String readDefaultFileLog(RawDistRootPath path) {
293293 }
294294
295295 protected static String readHttpAccessLogFile (RawDistRootPath path , String logName ) {
296- return readFile (path .getDistRootPath () + File .separator + "data" + File .separator + logName , "HTTP Access log" );
296+ return readFile (path .getDistRootPath () + File .separator + "data" + File .separator + "log" + File . separator + logName , "HTTP Access log" );
297297 }
298298
299299 protected static String readFile (String path , String fileType ) {
@@ -314,29 +314,33 @@ protected static String readFile(String path, String fileType) {
314314 void httpAccessLogNotNamedPattern (CLIResult cliResult , KeycloakDistribution dist , RawDistRootPath path ) {
315315 when ().get ("http://127.0.0.1:8080/realms/master/.well-known/openid-configuration" ).then ()
316316 .statusCode (200 );
317- cliResult .assertMessage ("[org.keycloak.http.access-log]" );
318- cliResult .assertMessage ("127.0.0.1 GET /realms/master/.well-known/openid-configuration" );
317+ Awaitility .await ().atMost (5 , TimeUnit .SECONDS ).untilAsserted (
318+ () -> cliResult .assertMessage ("[org.keycloak.http.access-log]" ));
319+ Awaitility .await ().atMost (5 , TimeUnit .SECONDS ).untilAsserted (
320+ () -> cliResult .assertMessage ("127.0.0.1 GET /realms/master/.well-known/openid-configuration" ));
319321
320322 when ().get ("http://127.0.0.1:8080/realms/master/clients/account/redirect" ).then ()
321323 .statusCode (200 );
322324 cliResult .assertNoMessage ("127.0.0.1 GET /realms/master/clients/account/redirect" );
323325
324326 // file
325- cliResult = dist .run ("start-dev" , "--http-access-log-enabled=true" , "--http-access-log-file-enabled=true" , "--http-access-log-pattern='%A %{METHOD} %{REQUEST_URL} %{i,User-Agent}'" , "--http-access-log-exclude=/realms/master/clients/.*" );
326- cliResult .assertStartedDevMode ();
327+ CLIResult fileCliResult = dist .run ("start-dev" , "--http-access-log-enabled=true" , "--http-access-log-file-enabled=true" , "--http-access-log-pattern='%A %{METHOD} %{REQUEST_URL} %{i,User-Agent}'" , "--http-access-log-exclude=/realms/master/clients/.*" );
328+ fileCliResult .assertStartedDevMode ();
327329 when ().get ("http://127.0.0.1:8080/realms/master/.well-known/openid-configuration" ).then ()
328330 .statusCode (200 );
329- cliResult .assertNoMessage ("[org.keycloak.http.access-log]" );
330- cliResult .assertNoMessage ("127.0.0.1 GET /realms/master/.well-known/openid-configuration" );
331+ fileCliResult .assertNoMessage ("[org.keycloak.http.access-log]" );
332+ fileCliResult .assertNoMessage ("127.0.0.1 GET /realms/master/.well-known/openid-configuration" );
331333
332334 when ().get ("http://127.0.0.1:8080/realms/master/clients/account/redirect" ).then ()
333335 .statusCode (200 );
334- cliResult .assertNoMessage ("127.0.0.1 GET /realms/master/clients/account/redirect" );
336+ fileCliResult .assertNoMessage ("127.0.0.1 GET /realms/master/clients/account/redirect" );
335337
336- String data = readHttpAccessLogFile (path , "keycloak-http-access.log" );
337- assertNotNull (data );
338- assertThat (data , containsString ("127.0.0.1 GET /realms/master/.well-known/openid-configuration" ));
339- assertThat (data , not (containsString ("127.0.0.1 GET /realms/master/clients/account/redirect" )));
338+ Awaitility .await ().atMost (5 , TimeUnit .SECONDS ).untilAsserted (() -> {
339+ String data = readHttpAccessLogFile (path , "keycloak-http-access.log" );
340+ assertNotNull (data );
341+ assertThat (data , containsString ("127.0.0.1 GET /realms/master/.well-known/openid-configuration" ));
342+ assertThat (data , not (containsString ("127.0.0.1 GET /realms/master/clients/account/redirect" )));
343+ });
340344 }
341345
342346 @ Test
@@ -351,10 +355,12 @@ void httpAccessLogFile(CLIResult cliResult, RawDistRootPath path) {
351355 .statusCode (200 );
352356 cliResult .assertNoMessage ("http://127.0.0.1:8080/realms/master/clients/account/redirect" );
353357
354- String data = readHttpAccessLogFile (path , "my-custom-http-access.txt" );
355- assertNotNull (data );
356- assertThat (data , containsString ("GET /realms/master/.well-known/openid-configuration HTTP/1.1" ));
357- assertThat (data , containsString ("GET /realms/master/clients/account/redirect" ));
358+ Awaitility .await ().atMost (5 , TimeUnit .SECONDS ).untilAsserted (() -> {
359+ String data = readHttpAccessLogFile (path , "my-custom-http-access.txt" );
360+ assertNotNull (data );
361+ assertThat (data , containsString ("GET /realms/master/.well-known/openid-configuration HTTP/1.1" ));
362+ assertThat (data , containsString ("GET /realms/master/clients/account/redirect" ));
363+ });
358364 }
359365
360366 // Telemetry Logs
0 commit comments