It was necessary to change from logback to log4j, I modified pom for this:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j</artifactId>
</dependency>
And 'log4j.properties' file was added:
log4j.rootLogger=INFO,Console
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.Target=System.out
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.conversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p - %m%n
But in result, there are different logs. With logback I have something like this:
2022-11-15 18:43:05.819 INFO 13700 --- [ main] en.main.com.Application : Starting Application using Java 11.0.14 on '' with PID 13700
2022-11-15 18:43:06.710 INFO 13700 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=eb6a152f-721c-3012-b9ce-880d2bbbe06c
2022-11-15 18:43:06.967 INFO 13700 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8081 (http)
2022-11-15 18:43:06.974 INFO 13700 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2022-11-15 18:43:06.974 INFO 13700 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.53]
2022-11-15 18:43:07.158 INFO 13700 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/main] : Initializing Spring embedded WebApplicationContext
2022-11-15 18:43:07.159 INFO 13700 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1298 ms
2022-11-15 18:43:07.898 INFO 13700 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8081 (http) with context path '/main'
2022-11-15 18:43:07.985 INFO 13700 --- [ main] en.main.com.Application : Started Application in 2.648 seconds (JVM running for 3.726)
And after log4j:
2022-11-15 18:38:00,817 INFO - Initializing ProtocolHandler ["http-nio-8081"]
2022-11-15 18:38:00,818 INFO - Starting service [Tomcat]
2022-11-15 18:38:00,818 INFO - Starting Servlet engine: [Apache Tomcat/9.0.53]
2022-11-15 18:38:01,057 INFO - Initializing Spring embedded WebApplicationContext
2022-11-15 18:38:02,890 INFO - Starting ProtocolHandler ["http-nio-8081"]
2022-11-15 18:38:03,001 INFO - HikariPool-1 - Starting...
2022-11-15 18:38:03,318 INFO - HikariPool-1 - Start completed.
2022-11-15 18:38:03,340 INFO - HikariPool-2 - Starting...
2022-11-15 18:38:03,397 INFO - HikariPool-2 - Start completed.
I can't understand why a part of useful information is missing. Also tried to display some transactions info, by adding
log4j.logger.org.springframework.jdbc.datasource.DataSourceTransactionManager=DEBUG
but there is no result.