Repository: quarkusio/quarkus
Issue: HTTP access log %t missing enclosing brackets

### Describe the bug

According to the [Common Log Format (CLF)](https://en.wikipedia.org/wiki/Common_Log_Format) the datetime specified as `%t` in http access logs should be enclosed in brackets as in `[10/Oct/2000:13:55:36 -0700]`, however this is not what you get when configuring your own pattern.

The problem lies in the following code ([see link here](https://github.com/quarkusio/quarkus/blob/2cbd177416f92b9f45abb34b6f01acb8cb0f4eb5/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/DateTimeAttribute.java#L16)):


```
    private static final String COMMON_LOG_PATTERN = "[dd/MMM/yyyy:HH:mm:ss Z]";
```

This pattern is fed to `DateTimeFormatter.ofPattern()` which, [according to the docs](https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html), treats the brackets as special characters denoting the start and end of an optional datetime part.

The trivial fix involves single-quoting the brackets in the pattern string as follows:

```
    private static final String COMMON_LOG_PATTERN = "'['dd/MMM/yyyy:HH:mm:ss Z']'";
```


### Expected behavior

The `%t` modifier in http access logs should print common log format datetime enclosed in brackets as in `[10/Oct/2000:13:55:36 -0700]`

### Actual behavior

The `%t` modifier in http access logs prints datetime without brackets as in `10/Oct/2000:13:55:36 -0700`

### How to Reproduce?

Either check access logs in a simple web app or contrast the output of the following expressions' evaluation:

1. `DateTimeFormatter.ofPattern("'['dd/MMM/yyyy:HH:mm:ss Z']'", Locale.US).format(ZonedDateTime.now())`
2. `DateTimeFormatter.ofPattern("[dd/MMM/yyyy:HH:mm:ss Z]", Locale.US).format(ZonedDateTime.now())`

### Output of `uname -a` or `ver`

Darwin Users-MacBook-Pro.local 22.3.0 Darwin Kernel Version 22.3.0: Thu Jan  5 20:53:49 PST 2023; root:xnu-8792.81.2~2/RELEASE_X86_64 x86_64

### Output of `java -version`

1.8.0_351

### GraalVM version (if different from Java)

_No response_

### Quarkus version or git rev

2.14.1

### Build tool (ie. output of `mvnw --version` or `gradlew --version`)

Apache Maven 3.8.1

### Additional information

_No response_

Changed files:
integration-tests/vertx-http/src/test/java/io/quarkus/it/vertx/AccessLogTestCase.java
extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/DateTimeAttribute.java

diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/DateTimeAttribute.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/DateTimeAttribute.java
index ade164d92f8..de5c3aae57b 100644
--- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/DateTimeAttribute.java
+++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/DateTimeAttribute.java
@@ -13,7 +13,7 @@
  */
 public class DateTimeAttribute implements ExchangeAttribute {
 
-    private static final String COMMON_LOG_PATTERN = "[dd/MMM/yyyy:HH:mm:ss Z]";
+    private static final String COMMON_LOG_PATTERN = "'['dd/MMM/yyyy:HH:mm:ss Z']'";
 
     public static final String DATE_TIME_SHORT = "%t";
     public static final String DATE_TIME = "%{DATE_TIME}";
diff --git a/integration-tests/vertx-http/src/test/java/io/quarkus/it/vertx/AccessLogTestCase.java b/integration-tests/vertx-http/src/test/java/io/quarkus/it/vertx/AccessLogTestCase.java
index da7b395710d..5d0051a1b75 100644
--- a/integration-tests/vertx-http/src/test/java/io/quarkus/it/vertx/AccessLogTestCase.java
+++ b/integration-tests/vertx-http/src/test/java/io/quarkus/it/vertx/AccessLogTestCase.java
@@ -2,7 +2,6 @@
 
 import static org.hamcrest.Matchers.containsString;
 
-import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -23,12 +22,11 @@ public class AccessLogTestCase {
     /**
      * Fires a HTTP request, to an application which has access log enabled and then checks
      * the access-log contents to verify that the request was logged
-     *
-     * @throws Exception
      */
     @Test
-    public void testAccessLogContent() throws Exception {
+    public void testAccessLogContent() {
         final Path logDirectory = Paths.get(".", "target");
+        final Path accessLogFilePath = logDirectory.resolve("quarkus-access-log.log");
         final String queryParamVal = UUID.randomUUID().toString();
         final String targetUri = "/simple/access-log-test-endpoint?foo=" + queryParamVal;
         RestAssured.when().get(targetUri).then().body(containsString("passed"));
@@ -37,15 +35,18 @@ public void testAccessLogContent() throws Exception {
                 .untilAsserted(new ThrowingRunnable() {
                     @Override
                     public void run() throws Throwable {
-                        final Path accessLogFilePath = logDirectory.resolve("quarkus-access-log.log");
                         Assertions.assertTrue(Files.exists(accessLogFilePath),
                                 "access log file " + accessLogFilePath + " is missing");
-                        String data = new String(Files.readAllBytes(accessLogFilePath), StandardCharsets.UTF_8);
-                        Assertions.assertTrue(data.contains(targetUri),
+                        String line = Files.readString(accessLogFilePath);
+                        Assertions.assertTrue(line.startsWith("127.0.0.1 - - ["),
+                                "access log doesn't contain request IP or does not wrap the date with []: " + line);
+                        Assertions.assertTrue(line.contains("] \\"GET"),
+                                "access log doesn't contain the HTTP method or does not wrap the date with []: " + line);
+                        Assertions.assertTrue(line.contains(targetUri),
                                 "access log doesn't contain an entry for " + targetUri);
-                        Assertions.assertTrue(data.contains("?foo=" + queryParamVal),
+                        Assertions.assertTrue(line.contains("?foo=" + queryParamVal),
                                 "access log is missing query params");
-                        Assertions.assertFalse(data.contains("?foo=" + queryParamVal + "?foo=" + queryParamVal),
+                        Assertions.assertFalse(line.contains("?foo=" + queryParamVal + "?foo=" + queryParamVal),
                                 "access log contains duplicated query params");
                     }
                 });