You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Volkan Yazici (Jira)" <ji...@apache.org> on 2022/05/27 09:18:00 UTC
[jira] [Comment Edited] (LOG4J2-3519) Log4j2 failed to load custom plugin
[ https://issues.apache.org/jira/browse/LOG4J2-3519?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17542709#comment-17542709 ]
Volkan Yazici edited comment on LOG4J2-3519 at 5/27/22 9:17 AM:
----------------------------------------------------------------
You do not need the packages attribute on the configuration element. If your jar is on the classpath then Log4j will find the Plugin via the {{Log4j2Plugins.dat}} definition.
was (Author: ralph.goers@dslextreme.com):
You do not need the packages attribute on the configuration element. If your jar is on the classpath then Log4j will find the Plugin via the Log4j2Plugins.data definition.
> 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)