2014-03-12 68 views
2

hy guys,用log4j記錄飛行路線?

是否有最佳做法,如何獲得flyway輸出到log4j日誌?

我目前正在與以下的log4j.xml運行:

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> 

<log4j:configuration> 
    <appender name="CA" class="org.apache.log4j.ConsoleAppender"> 
     <layout class="org.apache.log4j.PatternLayout"> 
      <param name="ConversionPattern" value="%-p - %m%n"/> 
     </layout> 
     <filter class="org.apache.log4j.varia.LevelRangeFilter"> 
      <param name="levelMin" value="INFO"/> 
      <param name="levelMax" value="ERROR"/> 
     </filter> 
    </appender> 

    <appender name="fileAppender" class="org.apache.log4j.RollingFileAppender"> 
     <param name="append" value="false"/> 
     <param name="file" value="log.out"/> 
     <param name="immediateFlush" value="true"/> 
     <layout class="org.apache.log4j.PatternLayout"> 
      <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/> 
     </layout> 
    </appender> 

    <logger name="com.googlecode.flyway.core.migration" additivity="false"> 
     <level value="DEBUG"/> 
     <appender-ref ref="fileAppender"/> 
    </logger> 

    <root> 
     <priority value="all"/> 
     <appender-ref ref="CA"/> 
     <appender-ref ref="fileAppender"/> 
    </root> 
</log4j:configuration> 

我已經搜索答案在線,但不能弄明白。

回答

2

如果它在類路徑中可用,則Flyway將自動使用Log4J。