【问题标题】:How to use Custom Log Configuration - Spring Boot如何使用自定义日志配置 - Spring Boot
【发布时间】:2014-07-22 02:57:33
【问题描述】:

在像this 这样的典型 Spring Boot 应用程序中,我们如何配置它以使用“自定义”日志配置?

例如,在我的应用程序运行的当前环境中,logback 导致错误,我该如何使用其他日志记录例如:

[INFO] java.lang.NoClassDefFoundError: java.io.FileOutputStream is a restricted class. Please see the Google  App Engine developer's guide for more details.    
[INFO]  at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:100)
    [INFO]  at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:58)
    [INFO]  at org.springframework.boot.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:181)
    [INFO]  at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:122)
    [INFO]  at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:98)
    [INFO]  at org.springframework.boot.context.event.EventPublishingRunListener.publishEvent(EventPublishingRunListener.java:92)
    [INFO]  at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:58)

【问题讨论】:

标签: java spring spring-boot


【解决方案1】:

Spring Boot 默认配置 Logback,您使用标准配置——只需在运行时将 logback.xmllogback.groovy 用作类路径资源即可。在 GAE 案例中,您需要将记录器配置为使用 GAE 批准的输出目标。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-06-24
    • 1970-01-01
    • 2016-06-07
    • 2020-08-02
    • 2018-12-24
    • 2020-02-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多