You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by Michael Conrad <mi...@newsrx.com> on 2021/10/07 13:37:03 UTC

SolrJ Logging in 8.x - how to get it to turn OFF!!?

SolrJ Logging in 8.x - how to get it to turn OFF ?

I have the following dependencies in my project:

     api 'org.apache.logging.log4j:log4j-api:2.14.+'
     api 'org.apache.logging.log4j:log4j-core:2.14.+'
     api 'org.apache.logging.log4j:log4j-1.2-api:2.14.+' // redirect 
log4j-v1 to log4j-v2
     api 'org.apache.logging.log4j:log4j-jcl:2.14.+' // redirect commons 
logging to log4j
     api 'org.apache.logging.log4j:log4j-slf4j-impl:2.14.+' // redirect 
slf4j to log4j
     api 'org.apache.logging.log4j:log4j-jul:2.14.+' // redirect java 
util logging to log4j

in combination with the following log4j2.xml file in src/main/resources/

<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
   <Appenders>
     <Console name="STDERR" target="SYSTEM_ERR">
       <PatternLayout>
         <Pattern>
           %maxLen{%-5p - %d{yyyy-MM-dd HH:mm:ss.SSS}; %c; %m%notEmpty{ 
=>%ex{short}}}{10240}%n
         </Pattern>
       </PatternLayout>
     </Console>
   </Appenders>
   <Loggers>
     <AsyncLogger name="org.apache.zookeeper" level="WARN"/>
     <AsyncLogger name="org.apache.hadoop" level="WARN"/>
     <AsyncLogger name="org.apache.solr" level="WARN"/>

     <AsyncRoot level="INFO">
       <AppenderRef ref="STDERR"/>
     </AsyncRoot>
   </Loggers>
</Configuration>

I've unpacked the final uber jar and verified the log4j2.xml file is in 
the root of the archive. I'm using shadowjar to package it up.

What am I missing?

There is so much useless logging happening I can't read the output for 
any useful information.




Re: SolrJ Logging in 8.x - how to get it to turn OFF!!?

Posted by Michael Conrad <mi...@newsrx.com>.
I gave up on log4j and switched to slf4j-simple. Now it is only logging 
WARN and above.

implementation 'org.slf4j:slf4j-simple:1.7.+'


On 10/7/21 11:39 AM, Shawn Heisey wrote:
> On 10/7/21 7:37 AM, Michael Conrad wrote:
>>     <AsyncLogger name="org.apache.zookeeper" level="WARN"/>
>>     <AsyncLogger name="org.apache.hadoop" level="WARN"/>
>>     <AsyncLogger name="org.apache.solr" level="WARN"/>
>
> <snip>
>
>> There is so much useless logging happening I can't read the output 
>> for any useful information. 
>
> If that log4j2.xml file is really taking effect, there should not be 
> much logging.  Solr and SolrJ are noisy at INFO but very quiet at WARN.
>
> Can you provide us with an excerpt from the verbose logging you see?
>
> If you start your program with 
> "-Dlog4j.configurationFile=/path/to/log4j2.xml" on the commandline you 
> can create your own logging config that does exactly what you want.
>
> Thanks,
> Shawn
>


Re: SolrJ Logging in 8.x - how to get it to turn OFF!!?

Posted by Shawn Heisey <ap...@elyograg.org>.
On 10/7/21 7:37 AM, Michael Conrad wrote:
>     <AsyncLogger name="org.apache.zookeeper" level="WARN"/>
>     <AsyncLogger name="org.apache.hadoop" level="WARN"/>
>     <AsyncLogger name="org.apache.solr" level="WARN"/>

<snip>

> There is so much useless logging happening I can't read the output for 
> any useful information. 

If that log4j2.xml file is really taking effect, there should not be 
much logging.  Solr and SolrJ are noisy at INFO but very quiet at WARN.

Can you provide us with an excerpt from the verbose logging you see?

If you start your program with 
"-Dlog4j.configurationFile=/path/to/log4j2.xml" on the commandline you 
can create your own logging config that does exactly what you want.

Thanks,
Shawn