I'm working in a Spring Boot Application using Gradle. I'm probably going to be giving a lot of unnecessary context here, but I'm not sure where my problem is.
I have an SLF4j logger that's resolving to a org.slf4j.impl.Log4jLoggerAdapter. I'm trying to change the log pattern layout for the console logs. The default pattern looks like:
2022-03-02 17:42:48.892 [ INFO] 19296 --- [ main] ggestions.jvm.JVMLatestVersionSuggestion
In the console output, the level, timestamp, and class path are all highlighted. However, I really don't like the format, and would like to overwrite it.
I've added the following to my application.yml:
logging.pattern.console: '%d [%t] %-5level %logger{36} - %m%n'
Which is giving me the layout that I want, but the highlighting disappears and it's all default color. I've seen advice to add %highlight, but that doesn't correctly display - it just shows up as the word %highlight in the output, like so:
2022-03-02 17:50:09,525 [main] %highlight(INFO ) com.indeed.common.boot.suggestions.jvm.JVMLatestVersionSuggestion
The logger is still resolving to org.slf4j.impl.Log4jLoggerAdapter. My guess is that it's because Log4j doesn't support highlighting, but then I'm not clear what was making it work in the first place. Is it possible to get it back?
(note: this is work code, and I don't have the ability to change the Slf4j implementation to Log4j2)