squirrel icon indicating copy to clipboard operation
squirrel copied to clipboard

squirrel-foundation中自带的log4j.properties会覆盖掉项目中的配置文件

Open xiayuqing opened this issue 6 years ago • 2 comments

image

如果squirrel-foundation的jar加载的顺序在项目jar包之前的话,log4j的配置就会优选第一个读到的配置,后续的就无效了。

作为一个工具性质的jar是不是不应该存在这个log4j.properties的文件,避免对业务项目配置的影响。

xiayuqing avatar Mar 26 '19 10:03 xiayuqing

you can exclusion that

            <groupId>org.squirrelframework</groupId>
            <artifactId>squirrel-foundation</artifactId>
            <version>0.3.8</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

0xAlbertChen avatar Aug 27 '19 12:08 0xAlbertChen

The exclusion doesn't work for me, when I use Maven assembly for creating a uber jar, the log4j.properties file is still there.

I think including log4j.properties is not the best practice and should be avoided. https://mkyong.com/maven/maven-exclude-log4j-properties-in-jar-file/

For instance, this is one question on stackoverflow, trying to address the exact same problem for squirrel-foundation library https://stackoverflow.com/questions/27851436/maven-remove-dependency-from-a-jar

niyue avatar Nov 11 '20 09:11 niyue