简体   繁体   中英

Spring boot + maven not printing logs on console

Running spring boot/java test project using maven through terminal is not printing logs.However when I run the project through Intellij(run configuration), it does print logs.

I have tried enable logging for spring boot by enabling logs in application.yml file but it didn't work. I have also observed that since intellij uses java to run the test project logging works however I am using maven from terminal so it doesn't work.

    logging:
      level:
        root: INFO
        org.package INFO

Enable logs in spring boot java project that prints stuff on terminal.

Besides from the indentation, you are missing the:

logging:
  level:
    root: INFO
    org.package: INFO

Also, you can configure the Logback for Spring-Boot, here is how to: logback

Basically, creating a logback.xml file in the resources path, with the content of:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <include resource="org/springframework/boot/logging/logback/base.xml"/>
    <logger name="org.springframework.web" level="DEBUG"/>
</configuration>

Here it is also another great tutorial: here

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