Currently, when we need to change the date-part of the logging pattern, we need to copy the pattern from defaults.xml and overwrite both console and file pattern, like this:

logging:
  pattern:
    console: '%clr(%d{"yyyy-MM-dd''T''HH:mm:ss,SSSZ"}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wEx'
    file: '%d{"yyyy-MM-dd''T''HH:mm:ss,SSSZ"} ${LOG_LEVEL_PATTERN:-%5p} ${PID:- } --- [%t] %-40.40logger{39} : %m%n%wEx'

The suggestion is to introduce LOG_DATEFORMAT_PATTERN, logging.pattern.dateformator some other well-chosen names for these, that allow us to just provide that piece of the logging pattern. Example:

logging:
  pattern:
    dateformat: "yyyy-MM-dd'T'hh:mm:ss,SSSZ"

**Comment From: philwebb**

The code in `LoggingSystemProperties` would need to be updated, as would the logging configuration files. I'm not keen to introduce too many of these (since it's hard to know when to stop) but this one does seem generally useful.


**Comment From: hdohlmann**

I took a shot at a contribution for this.
Not sure if the changes to log4j2 will work. I couldn't find any tests for that part.
Note that I now suggest a property called `logging.pattern.dateformat` to better fit with the existing `logging.pattern.*` properties.
I would have liked to devise a test containing this dateformat: `"yyyy-MM-dd'T'hh:mm:ss,SSSZ"`, but it seems the `MockEnvironment.setProperty` is not happy with a value containing a comma...


**Comment From: philwebb**

Closing in favor of PR #8516

**Comment From: elab**

I was trying to use `,` in `dateformat`, but all these definitions were not working (the part after the comma was ignored or the application didn't start at all):

yyyy-MM-dd hh:mm:ss,SSS "yyyy-MM-dd hh:mm:ss,SSS" yyyy-MM-dd hh:mm:ss','SSS "yyyy-MM-dd hh:mm:ss','SSS"

Also note this SO thread: [how to escape space comma doublequotes from yaml file](https://stackoverflow.com/questions/55923288/how-to-escape-space-comma-doublequotes-from-yaml-file).

Then I found the following in the [Logback docs](http://logback.qos.ch/manual/layouts.html):

> **common error** Given that the comma ',' character is interpreted as the parameter separator, the pattern HH:mm:ss,SSS will be interpreted as the pattern HM:mm:ss and the timezone SSS. If you wish to include a comma in your date pattern, then simply enclose the pattern between quotes. For example, %date{"HH:mm:ss,SSS"}.

Playing a little bit more with Spring Boot, I found these two working variants:

"'yyyy-MM-dd HH:mm:ss,SSS'" '"yyyy-MM-dd HH:mm:ss,SSS"' ``` Perhaps could be useful for someone else.