You should explicitly provide the jackson dependencies: jackson-core,
jackson-databind and/or jackson-annotations.

On Fri, Jul 24, 2020 at 8:24 AM t spam <spam....@gmail.com> wrote:

> Hi,
>
> I'm having difficulty configuring JsonLayout for appenders. I have the
> following in my log4j2.xml:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <Configuration>
>   <Appenders>
>
>     <Console name="STDOUT" target="SYSTEM_OUT">
>       <PatternLayout>
>         <Pattern>
>           %d{yyyy-MM-dd HH:mm:ss.SSS} %-5p (%t) [%X{collection} %X{shard}
> %X{replica} %X{core}] %c{1.} %m%n
>         </Pattern>
>       </PatternLayout>
>     </Console>
>
>     <RollingFile
>         name="RollingFile"
>         fileName="${sys:solr.log.dir}/solr.log"
>         filePattern="${sys:solr.log.dir}/solr.log.%i" >
>       <JsonLayout complete="false" compact="true" eventEol="true" />
>       <Policies>
>         <OnStartupTriggeringPolicy />
>         <SizeBasedTriggeringPolicy size="32 MB"/>
>       </Policies>
>       <DefaultRolloverStrategy max="10"/>
>     </RollingFile>
>
>     <RollingFile
>         name="SlowFile"
>         fileName="${sys:solr.log.dir}/solr_slow_requests.log"
>         filePattern="${sys:solr.log.dir}/solr_slow_requests.log.%i" >
>       <PatternLayout>
>         <Pattern>
>           %d{yyyy-MM-dd HH:mm:ss.SSS} %-5p (%t) [%X{collection} %X{shard}
> %X{replica} %X{core}] %c{1.} %m%n
>         </Pattern>
>       </PatternLayout>
>       <Policies>
>         <OnStartupTriggeringPolicy />
>         <SizeBasedTriggeringPolicy size="32 MB"/>
>       </Policies>
>       <DefaultRolloverStrategy max="10"/>
>     </RollingFile>
>
>   </Appenders>
>   <Loggers>
>     <Logger name="org.apache.hadoop" level="warn"/>
>     <Logger name="org.apache.solr.update.LoggingInfoStream" level="off"/>
>     <Logger name="org.apache.zookeeper" level="warn"/>
>     <Logger name="org.apache.solr.core.SolrCore.SlowRequest" level="info"
> additivity="false">
>       <AppenderRef ref="SlowFile"/>
>     </Logger>
>
>     <Root level="debug">
>       <AppenderRef ref="RollingFile"/>
>       <AppenderRef ref="STDOUT"/>
>     </Root>
>   </Loggers>
> </Configuration>
>
> For some reason it just stops logging anything. I only get the solr_gc.log
> and not the expected solr.log. I see an old thread mentioning the exact
> same issue (except that solr.log isn't even created in my case) but it
> wasn't resolved there. See here:
>
> http://mail-archives.apache.org/mod_mbox/lucene-solr-user/201809.mbox/%3cdb5pr0101mb211949c76c5c39472ecdff87f4...@db5pr0101mb2119.eurprd01.prod.exchangelabs.com%3e
>
> I see this behaviour with both SOLR 7 and 8.
>
> Am I missing something? Help is much appreciated.
>
> - Tijmen
>
> This was the original message:
>
> -----Ursprüngliche Nachricht-----
> Von: Shawn Heisey <apa...@elyograg.org>
> Gesendet: Freitag, 7. September 2018 17:58
> An: solr-user@lucene.apache.org
> Betreff: Re: Solr 7.4 and log4j2 JSONLayout
>
> On 9/6/2018 7:46 AM, Michael Aleythe, Sternwald wrote:
> > I'm trying to edit the log4j2 logging configuration for solr. The goal
> is to get a log
> file in json format. I configured the the JSONLayout for this purpose
> inside the rollingFile
> appender in the log4j2.xml. After this solr stops logging entirely.
> Solr.log file is empty.
> Only the solr-8983-console.log file contains 10 lines. The line
> "2018-09-06 13:22:25.378:INFO:oejs.Server:main:
> Started @2814ms" is the last one.
> > My first guess was that the jackson-core and jackson-databind jars were
> missing, but
> that did not fix the problem.
>
> As Varun said, jackson is already included in Solr.  You won't need to
> add any jars for that.
>
> > Does anyone know where to find error-messages or exceptions that point
> me towards whats
> going wrong here?
>
> Start Solr in the foreground, with the -f option.  This will cause
> Solr to log to the console.
> When Solr is started in the background, it suppresses console logging.
>
> I see that you have changed the logfile rollover size to 1MB.  If your
> Solr server sees much
> traffic, this is going to result in an extremely fast rollover, which
> may mean that you lose
> access to logged events VERY quickly.  This will especially be the
> case with JSON logging
> -- each event will take up a lot more space.
>
> Thanks,
> Shawn
>

Reply via email to