[ 
https://issues.apache.org/jira/browse/LOG4J2-728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14070322#comment-14070322
 ] 

Remko Popma edited comment on LOG4J2-728 at 7/22/14 2:48 PM:
-------------------------------------------------------------

Sorry for being unclear. 
During the log4j2 build, all classes containing plugin annotations are listed 
up in an index file in order to allow log4j2 to quickly find its plugins during 
startup. The log4j2 index file is located here: 
{{META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat}}

For custom plugins, a similar .dat file is created during the build of your 
plugin. This is done by the annotation processor that is included in the 
log4j-core jar. Without this .dat file log4j2 will not be able to find your 
plugin (there used to be an alternative mechanism with the packages="..." 
attribute in the <Configuration> element but since rc2 this does not work any 
more unfortunately).

The IntelliJ settings above were mentioned by another user on the mailing list 
as the steps they took to let IntelliJ generate the .dat file. (They ran "mvn 
package" next from inside IntelliJ.)

More detail from the Plugins page (latest version from trunk):

.... These (.dat) files are generated by an annotation processor contained in 
the log4j-core artifact which will automatically scan your code for Log4j 2 
plugins and output a metadata file in your processed classes. There is nothing 
extra that needs to be done to enable this; the Java compiler will 
automatically pick up the annotation processor on the class path unless you 
explicitly disable it. 

In that case, (so, in the case you explicitly disabled annotation processing, 
this is normally not the case) it would be important to add another compiler 
pass to your build process that only handles annotation processing using the 
Log4j 2 annotation processor class,         
{{org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor}}. To 
do this using Apache Maven, add the following execution to your 
_maven-compiler-plugin_ (version 2.2 or higher) build plugin:
{code}
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin</artifactId>
  <version>3.1</version>
  <executions>
    <execution>
      <id>log4j-plugin-processor</id>
      <goals>
        <goal>compile</goal>
      </goals>
      <phase>process-classes</phase>
      <configuration>
        <proc>only</proc>
        <annotationProcessors>
          
<annotationProcessor>org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor</annotationProcessor>
        </annotationProcessors>
      </configuration>
    </execution>
  </executions>
</plugin>
{code}


was (Author: [email protected]):
Sorry for being unclear. 
During the log4j2 build, all classes containing plugin annotations are listed 
up in an index file in order to allow log4j2 to quickly find its plugins during 
startup. The log4j2 index file is located here: 
{{META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat}}

For custom plugins, a similar .dat file is created during the build of your 
plugin. This is done by the annotation processor that is included in the 
log4j-core jar. Without this .dat file log4j2 will not be able to find your 
plugin (there used to be an alternative mechanism with the packages="..." 
attribute in the <Configuration> element but since rc2 this does not work any 
more unfortunately).

The IntelliJ settings above were mentioned by another user on the mailing list 
as the steps they took to let IntelliJ generate the .dat file. (They ran "mvn 
package" next from inside IntelliJ.)

> Look for log4j2.xml in assets folder (or the application data) in an Android 
> APK.
> ---------------------------------------------------------------------------------
>
>                 Key: LOG4J2-728
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-728
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Configurators
>    Affects Versions: 2.0-rc2
>         Environment: Android
>            Reporter: Nelson MELINA
>              Labels: android
>
> To add files in an Android apk, you need to put them in an assets folder and 
> then they are in an "assets" folder in the APK.
> Log4j 2 needs to find it there when it exists (not the case now).
> Also would it be possible to load the xml configuration file from the 
> application data ( 
> https://developer.android.com/guide/topics/data/data-storage.html ) ?



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to