Why doesn't spring boot application start completely after adding log?

Colleagues, this is part of my pom ...

<dependency>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter</artifactId>
                    <version>1.2.5.RELEASE</version>
            <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>
            <version>1.2.5.RELEASE</version>
        </dependency>

      

this is my \ src \ main \ resources \ log4j.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">

    <!-- Appenders -->
    <appender name="console" class="org.apache.log4j.ConsoleAppender">
        <param name="Target" value="System.out" />
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%-5p: [%d{MMM-dd HH:mm:ss,SSS}] %c{3} - %m%n" />
        </layout>
    </appender>


    <!-- File Appender -->
    <appender name="file" class="org.apache.log4j.RollingFileAppender">
        <param name="File" value="C:/LOGS/spring-ws.log"/>
        <param name="MaxFileSize" value="10000KB"/>
        <param name="MaxBackupIndex" value="20"/>
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%-5p: [%d{MMM-dd HH:mm:ss,SSS}] %c{3} - %m%n" />
        </layout>
    </appender>

   <logger name="org.springframework.ws.server.MessageTracing.received">
    <level value="TRACE"/>
    <appender-ref ref="console"/> 
    <appender-ref ref="file"/>
   </logger> 


   <logger name="org.springframework.ws.server.MessageTracing.sent">
    <level value="TRACE"/> 
    <appender-ref ref="console"/>
    <appender-ref ref="file"/>
   </logger>

</log4j:configuration>

      

After

mvn package spring-boot: repackage

and

java -jar target / app-ws.jar

I only get

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.2.5.RELEASE)

      

and nothing more.

Also the application creates C: / LOGS / spring-ws.log, but it is empty.

Why won't spring boot application start?

+3


source to share


2 answers


The problem was solved by adding the following looger to the log4j.xml:

 <logger name="org.springframework.boot">
        <level value="trace"/>
        <appender-ref ref="console"/>
        <appender-ref ref="file"/>
 </logger>

      



Hope this helps someone.

+2


source


You can add property to application.properties like:

logging.level.root=INFO

      

This will show just enough information to let you know about the mappings and basic information about the application. Other levels of logging you can use (source: log ):



Level Description

  • FATAL: Severe errors that cause premature termination. Expect them to be immediately visible in the status console.
  • ERROR: Other runtime errors or unexpected conditions. Expect them to be immediately visible in the status console.
  • ATTENTION
  • INFO Interesting runtime events (startup / shutdown). Expect them to be immediately visible on the console, so be conservative and keep to a minimum.
  • DEBUG details the flow through the system. Expect them to be written to logs only.
  • TRACE for more information. Expect them to be written to logs only.
0


source







All Articles