[ 
https://issues.apache.org/jira/browse/LOG4J2-3519?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

XIAOMING ZHAO closed LOG4J2-3519.
---------------------------------
    Resolution: Fixed

> Log4j2 failed to load custom plugin 
> ------------------------------------
>
>                 Key: LOG4J2-3519
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3519
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Plugins
>    Affects Versions: 2.17.1
>            Reporter: XIAOMING ZHAO
>            Priority: Major
>
> We got some issue to load the custom plugin.
> we add annotation Plugin like the following:
> @Plugin(name = "UnifiedLoggingFormat", category = Node.CATEGORY,
>         elementType = Layout.ELEMENT_TYPE, printObject = true)
> public class UnifiedLoggingFormat extends AbstractStringLayout
> then add the annotationProcessor in build.gradle
>    annotationProcessor( 'org.apache.logging.log4j:log4j-core:2.17.1')
>  
> after the build, we can see the  
> META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat in 
> the class jar file.
> > jar tvf *appender*.jar
>      0 Tue May 24 14:18:40 EDT 2022 META-INF/
>   1077 Tue May 24 14:18:40 EDT 2022 META-INF/MANIFEST.MF
>      0 Tue May 24 14:18:40 EDT 2022 META-INF/org/
>      0 Tue May 24 14:18:40 EDT 2022 META-INF/org/apache/
>      0 Tue May 24 14:18:40 EDT 2022 META-INF/org/apache/logging/
>      0 Tue May 24 14:18:40 EDT 2022 META-INF/org/apache/logging/log4j/
>      0 Tue May 24 14:18:40 EDT 2022 META-INF/org/apache/logging/log4j/core/
>      0 Tue May 24 14:18:40 EDT 2022 
> META-INF/org/apache/logging/log4j/core/config/
>      0 Tue May 24 14:18:40 EDT 2022 
> META-INF/org/apache/logging/log4j/core/config/plugins/
>    236 Tue May 24 14:18:40 EDT 2022 
> META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat
>  
> then in log42j.xml, we added the package of this custom plugin class.
> <Configuration status="trace" monitorInterval="30" 
> packages="com.server.logging.log4jappenders, com.common.utils">
>  
> but we still got the problem 
> FelixDispatchQueue DEBUG Took 0.003516 seconds to load 0 plugins from package 
> com.server.logging.log4jappenders
> FelixDispatchQueue DEBUG Took 0.000117 seconds to load 0 plugins from package 
> com.common.utils
>  
> Would you please help out?



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to