如何在spring-boot中禁用控制台日志记录? [英] How to disable console logging in spring-boot?

查看:258
本文介绍了如何在spring-boot中禁用控制台日志记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 spring-boot 的默认日志记录配置.

I'm using the default logging configuration of spring-boot.

在保持登录到使用 logging.file = myfile.log 配置的日志文件的同时,如何防止控制台输出?

How can I prevent the console output, while keeping the logging into a logfile configured with logging.file=myfile.log?

我的目标是没有控制台Windows输出,而仅记录到该文件.

My goal is to not having console windows output, but only logging to that file.

无需创建特定的 logback.xml 配置.因为我使用 spring-boot 不必自己配置日志记录.

Without having to create a specific logback.xml configuration. Because I'm using spring-boot for not having to configure the logging myself.

推荐答案

原来,如果我将以下属性设置为空,则会禁用控制台日志记录:

It turned out if I set the following property empty, the console logging is disabled:

logging.pattern.console =

或者使用xml进行注释

Or commenting in xml if you use it

  <!--<root level="error">-->
        <!--<appender-ref ref="console"/>-->
    <!--</root>-->

这篇关于如何在spring-boot中禁用控制台日志记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆