排除log4j-api ( 排除log4j )


寫法都一樣,排除log4j,或者其相關的依賴

1. gradle
  1.1 判斷是否有log4j
    a. 將war或jar解壓后,搜索log4j
    b. 使用IDEA gradle菜單, 項目名-> Tasks -> help -> dependencies 雙擊,在返回結果中搜索log4j
    c. ...

  1.2 排除或指定log4j
    a. spring部分包中自帶有log4j-api的包,可以排除,或強制指定版本

compile ("org.springframework.boot:xxxx") {
  exclude group:'org.springframework.boot', module: "spring-boot-start-logging"
}
compile('org.apache.logging.log4j:log4j-api:2.17.0') {
  force = true
}

  

  

2. maven:
  1.1 判斷是否有log4j
    a. 將war或jar解壓后,搜索log4j
    b. 使用IDEA maven菜單,項目名-> Tasks -> help -> dependencies 雙擊,在返回結果中搜索log4j
    c. ...

  1.2 排除或指定log4j
    a. spring部分包中自帶有log4j-api的包,可以排除,或強制指定版本
 

<exclusions>
	<exclusion>
		<groupId>org.apache.logging.log4j</groupId>
		<artifactId>log4j-to-slf4j</artifactId>
	</exclusion>
</exclusions>

<dependencyManagement>
	<dependencies>
		<dependency>
			<groupId>org.apache.logging.log4j</groupId>
			<artifactId>log4j-api</artifactId>
			<version>2.17.0</version>
		</dependency>
	</dependencies>
</dependencyManagement>

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM