この例はMavenを使ってJarファイルから `log4j.properties`ファイルを除外する方法を示しています。

pom.xml

<project>

  <build>
    <plugins>

    <!-- Make this jar executable -->
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
                <!-- exclude log4j.properties -->
            <excludes>
                <exclude>** ** /log4j.properties</exclude>
            </excludes>
            <archive>
                <manifest>
                <addClasspath>true</addClasspath>
                <mainClass>com.mkyong.core.utils.testing</mainClass>
                <classpathPrefix>dependency-jars/</classpathPrefix>
                    </manifest>
            </archive>
        </configuration>
    </plugin>

    </plugins>
  </build>

</project>


log4j.properties`ファイルを

log4j.configuration`システムプロパティを使ってこのように渡してください

$ java -jar -Dlog4j.configuration=file:/full__path/log4j.properties final.jar