2015-10-20 67 views
2

我有資源文件夾下的log4j.properties文件。現在我在application.properties文件中傳遞logging.file =/Users/jkuriakos/web/rnt/dr/rnt.log。 如何使用log4j.properties文件從log4j.properties文件加載所有信息(如smtp服務器等)?春天引導日誌與log4.properties文件不工作

回答

0

排除從您的POM文件彈簧引導啓動日誌記錄,並添加以下的依賴:

<dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-log4j</artifactId> 
    </dependency> 

這應該使春季啓動拿起從資源文件夾log4j.properties。 http://docs.spring.io/spring-boot/docs/current/reference/html/howto-logging.html#howto-configure-log4j-for-logging

+0

謝謝。我通過在build.gradle中添加它來修復它,例如配置{*所有* .exclude模塊:'spring-boot-starter-logging' }並且通過添加compile('org.springframework.boot:spring-boot-starter- log4j')進入依賴關係。現在我有另一個問題。我怎樣才能從主類做同樣的排除。以下是我的主要課程。 @SpringBootApplication 公共類的應用{ \t公共靜態無效的主要(字串[] args)拋出異常{ \t \t SpringApplication.run(Application.class); \t}} – user2873253