Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why spring boot application does not start fully after adding logging?

Collegues, 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 receive only

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

and nothing more.

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

Why spring boot application does not start?

like image 489
May12 Avatar asked Jul 30 '15 12:07

May12


1 Answers

The problem was solved by adding into log4j.xml next looger:

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

Hope this will help to somebody.

like image 150
May12 Avatar answered Oct 23 '22 10:10

May12