使用 IntelliJ IDEA 运行 Spring Boot 应用,日志是有颜色,如下图:
但是使用 docker 运行的话,docker container logs
没有颜色,怎么让它具有颜色呢?
![]() |
1
xuanbg 12 天前
用 idea 的 docker 插件制作镜像并运行容器,也是有颜色的。但自己运行容器就没了。。。
|
![]() |
2
chendy 12 天前 ![]() |
4
JasonLaw 12 天前
@xuanbg #1
@chendy #2 https://stackoverflow.com/questions/32694928/docker-logs-not-showing-colors-express-nodejs-image 我加了-it 之后,日志是有颜色的,但是 container 就不能后台运行了。 |
5
bianjp 12 天前 ![]() Spring Boot 有个配置项: spring.output.ansi.enabled ( https://docs.spring.io/spring-boot/docs/2.4.4/api/org/springframework/boot/ansi/AnsiOutput.Enabled.html), 默认是 detected, 配置为 always 试试。
|