简体   繁体   中英

How to use Custom Log Configuration - Spring Boot

In a typical Spring Boot application like this , how do we configure it to use a "custom" log configuration?

For example, in the current environment that my app runs, logback is causing error, how can I use other logging for example:

[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)

Spring Boot configures Logback by default, and you use standard configuration--just have a logback.xml or logback.groovy available as a classpath resource at runtime. In the GAE case, you'll need to configure the logger to use GAE-approved output targets.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM