yvasyliev commented on issue #1386:
URL: 
https://github.com/apache/logging-log4j2/issues/1386#issuecomment-1481764735

   @ppkarwasz thank you for the assistance!
   
   ---
   
   The next config worked for me:
   
   <table>
   <tr><th>
   
   📄`pom.xml`
   
   </th></tr>
   <tr><td>
   
   ```xml
   <?xml version="1.0" encoding="UTF-8"?>
   <project xmlns="http://maven.apache.org/POM/4.0.0";
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
   <modelVersion>4.0.0</modelVersion>
   
       <groupId>demo.log4j2</groupId>
       <artifactId>log4j2-demo</artifactId>
       <version>1.0.0</version>
   
       <properties>
           <maven.compiler.source>17</maven.compiler.source>
           <maven.compiler.target>17</maven.compiler.target>
           <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
       </properties>
   
       <build>
           <plugins>
               <plugin>
                   <groupId>org.apache.maven.plugins</groupId>
                   <artifactId>maven-shade-plugin</artifactId>
                   <version>3.4.1</version>
                   <dependencies>
                       <dependency>
                           <groupId>io.github.edwgiz</groupId>
                           
<artifactId>log4j-maven-shade-plugin-extensions</artifactId>
                           <version>2.20.0</version>
                       </dependency>
                   </dependencies>
                   <executions>
                       <execution>
                           <goals>
                               <goal>shade</goal>
                           </goals>
                           <phase>package</phase>
                           <configuration>
                               
<shadedArtifactAttached>true</shadedArtifactAttached>
                               <transformers>
                                   <transformer 
implementation="io.github.edwgiz.log4j.maven.plugins.shade.transformer.Log4j2PluginCacheFileTransformer"/>
                                   <transformer 
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                       
<mainClass>demo.log4j2.MyAppender</mainClass>
                                   </transformer>
                               </transformers>
                           </configuration>
                       </execution>
                   </executions>
               </plugin>
           </plugins>
       </build>
   
       <dependencies>
           <dependency>
               <groupId>org.slf4j</groupId>
               <artifactId>slf4j-api</artifactId>
               <version>2.0.7</version>
           </dependency>
           <dependency>
               <groupId>org.apache.logging.log4j</groupId>
               <artifactId>log4j-slf4j2-impl</artifactId>
               <version>2.20.0</version>
           </dependency>
           <dependency>
               <groupId>org.apache.logging.log4j</groupId>
               <artifactId>log4j-core</artifactId>
               <version>2.20.0</version>
           </dependency>
       </dependencies>
   </project>
   ```
   
   </td></tr>
   </table>
   
   ```shell
   C:\Users\Yevhen\IdeaProjects\log4j2-demo\target>java -jar 
log4j2-demo-1.0.0-shaded.jar
   WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will 
impact performance.
   Hello world!
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to