loggingjbosswildflywildfly-10

Change date format in Wildfly(JBoss) access log


access_log in wildfly logs the entries with the following predefined date format, which is produced by %t:

[22/Oct/2019:14:28:36 +0300]

However, I would like to change that to be as below:

[22/10/2019 14:28:36.345]

I have tried to change the pattern in standalone xml file as below:

<access-log pattern="%{dd/MMM/yyyy:HH:mm:ss Z}t %t %h %l %u &quot;%r&quot;s %s %b &quot;%{i,Referer}&quot; &quot;%{i,User-Agent}&quot;"/>                       

However, the following is being logged instead:

%{dd/MMM/yyyy:HH:mm:ss Z}t [22/Oct/2019:14:28:36 +0300] 127.0.0.1 - - "GET /favicon.ico HTTP/1.1"s 302 - "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36"

How can I format the date properly?

I use wildfly-10.1.0. I have also tried the format below, that can be used for the apache access logs: But without any success.

There are other similar questions online, but have not been answered.


Solution

  • Following a lot of troubleshooting, I have finally found the answer, which might be helpful to other people as well:

    It is by adding the word 'time' as another argument in the formatter. As below:

    <access-log pattern="[%{time,dd/MM/yyyy HH:mm:ss.SSS}] %h %l %u &quot;%r&quot; %s %b &quot;%{i,Referer}&quot; &quot;%{i,User-Agent}&quot;"/>