0

I have a small Spring boot project. This project used Log4j before but I'm swaping to slf4j. With both log system I have something that I don't understand when I start my application :

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: 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)

So those are the logs when my app start/ From this line :

août 10, 2022 1:50:17 PM org.apache.coyote.AbstractProtocol init

to this line :

INFO: Initializing Spring embedded WebApplicationContext

And those two lines :

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

They are displayed in red like a System.err output and I would Like to know why enter image description here

This is the properties of my project :


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

And this is my logback.xml file

<?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>

Those reds logs seems to be with Tomcat so I tried to desactivate the tomcat Logs without any success. The parameters of my IDE are fine, others project don't have this issue, those lignes are displayed well in white

Bastien
  • 71
  • 1
  • 13
  • 1
    Does this answer your question? [Debug mode: Red messages are confusing me](https://stackoverflow.com/questions/55961047/debug-mode-red-messages-are-confusing-me) – Vlad Nitu Aug 10 '22 at 12:08
  • @VladNitu no its does not, my parameters are correct there. The weird thing is that I have others project and thos logs are displaying correctly like a normal System.out – Bastien Aug 10 '22 at 12:10
  • slf4j is a logger facade, you actually seem to be switching to logback. In any case, I guess you need to add the jul-to-slf4j library to your project (as I believe java.util.logging that is the default logging platform used by Tomcat). – Mark Rotteveel Aug 10 '22 at 14:41

0 Answers0