[ https://issues.apache.org/jira/browse/SOLR-16342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17581307#comment-17581307 ]
Jan Høydahl commented on SOLR-16342: ------------------------------------ Thanks for the report. Do you see the same for Solr 9.0? Are you able to proivde a fix (Pull Request) that adds the needed libs (or symlinks)? Ideally this should be fixed in the Gradle build, but the libs should not be duplicated. > <JsonLayout /> not working > -------------------------- > > Key: SOLR-16342 > URL: https://issues.apache.org/jira/browse/SOLR-16342 > Project: Solr > Issue Type: Bug > Security Level: Public(Default Security Level. Issues are Public) > Components: Docker > Affects Versions: 8.11.2 > Reporter: Zaccheo Bagnati > Priority: Minor > > We customized a solr 8.1.2 docker image by adding a custom log4j2 > configuration in order to log in json format. > The custom configuration is simply replacing the <PatternLayout> with > <JsonLayout> in the main log file: > {code:java} > <RollingRandomAccessFile > name="MainLogFile" > fileName="${sys:solr.log.dir}/solr.log" > filePattern="${sys:solr.log.dir}/solr.log.%i" > > <JsonLayout /> > <Policies> > <OnStartupTriggeringPolicy /> > <SizeBasedTriggeringPolicy size="32 MB"/> > </Policies> > <DefaultRolloverStrategy max="10"/> > </RollingRandomAccessFile> {code} > We then set the LOG4J_PROPS variable point to the custom log4j configuration. > It is not working due to this error: > {code:java} > ERROR Could not create plugin of type class > org.apache.logging.log4j.core.layout.JsonLayout for element JsonLayout: > java.lang.NoClassDefFoundError: > com/fasterxml/jackson/databind/ser/FilterProvider > java.lang.NoClassDefFoundError: > com/fasterxml/jackson/databind/ser/FilterProvider > at > org.apache.logging.log4j.core.layout.JsonLayout.<init>(JsonLayout.java:159) > at > org.apache.logging.log4j.core.layout.JsonLayout.<init>(JsonLayout.java:71) > at > org.apache.logging.log4j.core.layout.JsonLayout$Builder.build(JsonLayout.java:103) > at > org.apache.logging.log4j.core.layout.JsonLayout$Builder.build(JsonLayout.java:79) > at > org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:122) > at > org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:1120) > at > org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:1045) > at > org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:1037) > at > org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:1037) > at > org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:651) > at > org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:247) > at > org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:293) > at > org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:626) > at > org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:699) > at > org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:716) > at > org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:270) > at > org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:155) > at > org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:47) > at org.apache.logging.log4j.LogManager.getContext(LogManager.java:196) > at > org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:137) > at > org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:55) > at > org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:47) > at > org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:33) > at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358) > at org.eclipse.jetty.util.log.Slf4jLog.<init>(Slf4jLog.java:36) > at org.eclipse.jetty.util.log.Slf4jLog.<init>(Slf4jLog.java:30) > at > java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native > Method) > at > java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) > at > java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) > at > java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) > at org.eclipse.jetty.util.log.Log.initialized(Log.java:158) > at org.eclipse.jetty.util.log.Log.getLogger(Log.java:278) > at org.eclipse.jetty.util.log.Log.getLogger(Log.java:267) > at > org.eclipse.jetty.xml.XmlConfiguration.<clinit>(XmlConfiguration.java:88) > at > java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.base/java.lang.reflect.Method.invoke(Method.java:566) > at org.eclipse.jetty.start.Main.invokeMain(Main.java:218) > at org.eclipse.jetty.start.Main.start(Main.java:491) > at org.eclipse.jetty.start.Main.main(Main.java:77) > Caused by: java.lang.ClassNotFoundException: > com.fasterxml.jackson.databind.ser.FilterProvider > at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:476) > at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589) > at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) > ... 41 more > {code} > It seems that the jackson library is not in the classpath. > As a workaround we symlinked the jackson libraries that exists in the > /opt/solr/server/solr-webapp/webapp/WEB-INF/lib/ directory to > /opt/solr/server/lib/ext/ while building the docker image: > {code:java} > ... > RUN ln -s > /opt/solr/server/solr-webapp/webapp/WEB-INF/lib/jackson-core-2.13.3.jar > /opt/solr/server/lib/ext/jackson-core-2.13.3.jar && \ > ln -s > /opt/solr/server/solr-webapp/webapp/WEB-INF/lib/jackson-databind-2.13.3.jar > /opt/solr/server/lib/ext/jackson-databind-2.13.3.jar && \ > ln -s > /opt/solr/server/solr-webapp/webapp/WEB-INF/lib/jackson-annotations-2.13.3.jar > /opt/solr/server/lib/ext/jackson-annotations-2.13.3.jar > ... > {code} > The expected behavior is that it should work "out of the box" since the json > log is also mentioned in the documentation in > https://solr.apache.org/guide/8_11/configuring-logging.html -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org