Partage
  • Partager sur Facebook
  • Partager sur Twitter

Spring boot : Certains logs sont affiché en rouge

    10 août 2022 à 14:23:09

    Bonjour à tous.

    Je suis sur un petit projet Spring Boot et je viens de passer de Log4j a Slf4j pour les logs.
     
    Mais avec les deux j'ai le même soucis, quand je lance mon appli j'ai ça :
      .   ____          _            __ _ _
     /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
    ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
     \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
      '  |____| .__|_| |_|_| |_\__, | / / / /
     =========|_|==============|___/=/_/_/_/
     :: Spring Boot ::                (v2.6.4)
    
    2022-08-10 13:50:15.822  INFO 9136 --- [           main] c.a.SVSApplication                       : Starting SVSApplication using Java 17.0.4 on L10729 with PID 9136 (C:\WorkSpace\SVS2\back\target\classes started by bjulliot001 in C:\WorkSpace\SVS2)
    2022-08-10 13:50:15.834  INFO 9136 --- [           main] c.a.SVSApplication                       : No active profile set, falling back to 1 default profile: "default"
    2022-08-10 13:50:17.281  INFO 9136 --- [           main] o.s.b.w.e.t.TomcatWebServer              : Tomcat initialized with port(s): 8081 (http)
    août 10, 2022 1:50:17 PM org.apache.coyote.AbstractProtocol init
    INFO: Initializing ProtocolHandler ["http-nio-127.0.0.1-8081"]
    août 10, 2022 1:50:17 PM org.apache.catalina.core.StandardService startInternal
    INFO: Starting service [Tomcat]
    août 10, 2022 1:50:17 PM org.apache.catalina.core.StandardEngine startInternal
    INFO: Starting Servlet engine: [Apache Tomcat/9.0.58]
    août 10, 2022 1:50:17 PM org.apache.catalina.core.ApplicationContext log
    INFO: Initializing Spring embedded WebApplicationContext
    2022-08-10 13:50:17.450  INFO 9136 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1561 ms
    2022-08-10 13:50:17.627  INFO 9136 --- [           main] .s.s.UserDetailsServiceAutoConfiguration : 
    
    Using generated security password: d03e5995-a3d2-4cd6-8d42-303f6afe1d34
    
    2022-08-10 13:50:17.721  INFO 9136 --- [           main] o.s.s.w.DefaultSecurityFilterChain       : Will not secure any request
    2022-08-10 13:50:18.255  INFO 9136 --- [           main] o.s.l.c.s.AbstractContextSource          : Property 'userDn' not set - anonymous context will be used for read-write operations
    août 10, 2022 1:50:18 PM org.apache.coyote.AbstractProtocol start
    INFO: Starting ProtocolHandler ["http-nio-127.0.0.1-8081"]
    2022-08-10 13:50:18.362  INFO 9136 --- [           main] o.s.b.w.e.t.TomcatWebServer              : Tomcat started on port(s): 8081 (http) with context path '/svs/v1'
    2022-08-10 13:50:18.380  INFO 9136 --- [           main] c.a.SVSApplication                       : Started SVSApplication in 2.971 seconds (JVM running for 3.825)
    
    
    (On ne peut pas mettre d'image du coup ce n'est pas hyper clair mais ce bloc la dans les logs :

    août 10, 2022 1:50:17 PM org.apache.coyote.AbstractProtocol init
    INFO: Initializing ProtocolHandler ["http-nio-127.0.0.1-8081"]
    août 10, 2022 1:50:17 PM org.apache.catalina.core.StandardService startInternal
    INFO: Starting service [Tomcat]
    août 10, 2022 1:50:17 PM org.apache.catalina.core.StandardEngine startInternal
    INFO: Starting Servlet engine: [Apache Tomcat/9.0.58]
    août 10, 2022 1:50:17 PM org.apache.catalina.core.ApplicationContext log
    INFO: Initializing Spring embedded WebApplicationContext
    

    Et les deux lignes la :
    août 10, 2022 1:50:18 PM org.apache.coyote.AbstractProtocol start
    INFO: Starting ProtocolHandler ["http-nio-127.0.0.1-8081"]

    sont en rouge et je ne comprend pas pourquoi.

    Les paramètres de mon IDE sont bon, et j'ai d'autres projets qui affichent ses lignes en blanc, normalement.

    Voici mon fichier properties :

    # Map pour GraphHopper (outil routing)
    
    server.servlet.context-path=/svs/v1
    server.address=127.0.0.1
    server.port=8081
    
    logging.level.org.springframework=ERROR
    logging.level.com.avem=DEBUG
    logging.level.org.springframework.web=INFO
    logging.level.org.hibernate=ERROR
    logging.level.net.guides=DEBUG
    logging.level.root=INFO
    logging.file=app.log
    logging.config = logback.xml
    
    logging.path=logs
    
    
    logging.pattern.file=%d %p %c{1.} [%t] %m%n
    logging.pattern.console=%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n
    
    
    logging.level.org.apache=DEBUG
    



    et mon fichier logback.xml :

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
    
        <property name="HOME_LOG" value="logs/app.log"/>
    
        <appender name="FILE-ROLLING" class="ch.qos.logback.core.rolling.RollingFileAppender">
            <file>${HOME_LOG}</file>
    
            <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
                <fileNamePattern>logs/archived/app.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
                <!-- each archived file, size max 10MB -->
                <maxFileSize>10MB</maxFileSize>
                <!-- total size of all archive files, if total size > 20GB,
    				it will delete old archived file -->
                <totalSizeCap>20GB</totalSizeCap>
                <!-- 60 days to keep -->
                <maxHistory>60</maxHistory>
            </rollingPolicy>
    
            <encoder>
                <pattern>%d %p %c{1.} [%t] %m%n</pattern>
            </encoder>
        </appender>
    
        <logger name="com.avem" level="debug" additivity="false">
            <appender-ref ref="FILE-ROLLING"/>
        </logger>
    
        <root level="error">
            <appender-ref ref="FILE-ROLLING"/>
        </root>
    
    </configuration>

    Merci de votre aide



    • Partager sur Facebook
    • Partager sur Twitter

    Spring boot : Certains logs sont affiché en rouge

    × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
    × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
    • Editeur
    • Markdown