any advice on how you deal with solrj's logging?

1,144 views
Skip to first unread message

Jonathan Rochkind

unread,
Jul 11, 2013, 1:33:11 PM7/11/13
to solrma...@googlegroups.com
I am trying my own playing around with SolrJ.

And getting confused about the right way to handle SolrJ's logging,
especially in 4.3.

Would appreciate if Bob or anyone else has any tips or can give me any
info about what SolrMarc does, or point me to source code.

To begin with, I guess you need to configure log4j, when using SolrJ
4.3, to avoid having Solr complain about, well...

log4j:WARN No appenders could be found for logger
(org.apache.solr.client.solrj.impl.HttpClientUtil).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for
more info.


Does SolrMarc do something to keep SolrJ 4.3 from issuing this warning,
or does it just ignore it and keep going?

Does SolrMarc do anything to try and configure SolrJ's logging? To try
and unify SolrJ's own logging with any logging SolrMarc itself does, in
the same log file or whatever?

This stuff is indeed really confusing, I figure maybe you've had to
cross these paths in SolrMarc, and would be so grateful if you could
give me a few tips to learn from your experience. Just getting a handle
on what SolrMarc is actually doing (since it's apparently 'good
enough'), even if that's just "nothing, we just ignore that warning
message" would be helpful.

Jonathan

Naomi Dushay

unread,
Jul 11, 2013, 2:29:52 PM7/11/13
to solrma...@googlegroups.com
Jonathan,

Have you looked at this?
http://wiki.apache.org/solr/SolrLogging

The logging changed with Solr 4.3. You have to set up your Solr web server to use either log4j or java util logging

Here's what I have in the Solrj lib directory in my build of solrmarc for 4.3.0:

-rw-rw-r-- 1 blacklight blacklight 163151 May 29 17:51 commons-io-2.1.jar
-rw-rw-r-- 1 blacklight blacklight 433071 May 29 17:51 httpclient-4.2.3.jar
-rw-rw-r-- 1 blacklight blacklight 223571 May 29 17:51 httpcore-4.2.2.jar
-rw-rw-r-- 1 blacklight blacklight 26477 May 29 17:51 httpmime-4.2.3.jar
-rw-rw-r-- 1 blacklight blacklight 17289 May 29 17:51 jcl-over-slf4j-1.6.6.jar
-rw-rw-r-- 1 blacklight blacklight 4955 May 29 17:51 jul-to-slf4j-1.6.6.jar
-rw-rw-r-- 1 blacklight blacklight 481535 May 29 17:51 log4j-1.2.16.jar
-rw-rw-r-- 1 blacklight blacklight 22545 May 29 17:51 noggit-0.5.jar
-rw-rw-r-- 1 blacklight blacklight 26176 May 29 17:51 slf4j-api-1.6.6.jar
-rw-rw-r-- 1 blacklight blacklight 9711 May 29 17:51 slf4j-log4j12-1.6.6.jar
-rw-rw-r-- 1 blacklight blacklight 520969 Nov 13 2012 wstx-asl-3.2.7.jar
-rw-rw-r-- 1 blacklight blacklight 779974 May 29 17:51 zookeeper-3.4.5.jar

the logging jars are:

jcl-over-slf4j-1.6.6.jar
jul-to-slf4j-1.6.6.jar
log4j-1.2.16.jar
slf4j-log4j12-1.6.6.jar
slf4j-api-1.6.6.jar

I had to upgrade to jetty8 (from jetty6) to use Solr 4.3 with the jetty bundled with SolrMarc.

- Naomi
> --
> You received this message because you are subscribed to the Google Groups "solrmarc-tech" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to solrmarc-tec...@googlegroups.com.
> To post to this group, send email to solrma...@googlegroups.com.
> Visit this group at http://groups.google.com/group/solrmarc-tech.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Jonathan Rochkind

unread,
Jul 11, 2013, 2:55:31 PM7/11/13
to solrma...@googlegroups.com, Naomi Dushay
Yes, I definitely have a spent a lot of time with that page.

Yes, I have all those jars too. My SolrJ IS actually working, there's no
fatal error, just the warning about not setting up logging properly. So
it's just a loose end.

I notice you don't list a log4j.properties in your setup. Do you have one?

If not... are you getting that log4j warning in your console? Maybe
you're getting it but just never noticed it? Want to fire it up with
solr 4.3 and take a look at your stdout/stderr/logs and see if you've
got that log4j warning in em?

It may be that everyone has been just ignoring that warning, while not
setting up logging fully. I have no idea if SolrJ actually outputs any
log lines as part of the 'add' operations we're doing -- if it does, I
don't know if, without the log4j.properties, those log lines wind up on
stderr, or just to /dev/null, or what.


log4j:WARN No appenders could be found for logger
(org.apache.solr.client.solrj.impl.HttpClientUtil).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for
more info.


Simon Spero

unread,
Jul 11, 2013, 3:09:12 PM7/11/13
to solrma...@googlegroups.com, Naomi Dushay
It's logging via slf4j, which is selects which logging framework to use based on what jars it is bundled with.  
If you remove all the slf4j-* jar files from your class path *except for* slf4j-api and slf4j-simple, you will get a simple logger, which always logs to stderr, and only logs messages at priority INFO and above.

To unsubscribe from this group and stop receiving emails from it, send an email to solrmarc-tech+unsubscribe@googlegroups.com.

To post to this group, send email to solrma...@googlegroups.com.
Visit this group at http://groups.google.com/group/solrmarc-tech.
For more options, visit https://groups.google.com/groups/opt_out.


--
You received this message because you are subscribed to the Google Groups "solrmarc-tech" group.
To unsubscribe from this group and stop receiving emails from it, send an email to solrmarc-tech+unsubscribe@googlegroups.com.

Simon Spero

unread,
Jul 11, 2013, 3:33:41 PM7/11/13
to solrma...@googlegroups.com
Changed Ivy file:

<ivy-module version="2.0">
    <info organisation="org.jrock" module="jrockit"/>
   <dependencies>
        <dependency org="org.apache.solr" name="solr-solrj" rev="latest.release" conf="default" />
        <dependency org="org.slf4j" name="slf4j-simple" rev="latest.release" conf="default"/>
   </dependencies>
</ivy-module>

Naomi Dushay

unread,
Jul 11, 2013, 5:15:00 PM7/11/13
to solrma...@googlegroups.com
oops - meant to send to list.
On Jul 11, 2013, at 2:14 PM, Naomi Dushay wrote:

> I do have a log4j.properties file. My build.xml is really different from Bob's. It ends up in the top level of my dist directory, which is also diff than Bob's (I don't do the single jar to rule them all)
>
> my dist looks like this:
>
> log4.properties
> lib/(solrj jars and logging jars)
> SolrMarc.jar <-- the core code
> /StanfordSearchWorksSolrMarc.jar <-- my site code
> sw_config.properties
> sw_index.properties
> translation_maps
>
>
> I worked through a lot of these types of errors, but it was a while ago and I had to do it first for tomcat on a server box, and then for jetty in the solrmarc code. I got it all working and promptly forgot what I did -- I have a local branch of solrmarc that works with 4.3. I use a git repo inside our firewall, so the code out on github (https://github.com/solrmarc/stanford-solr-marc) doesn't have this yet. I'm on a deadline, but I can see if I can get that code updated. I was sort of waiting until we got Solr 4.3 into production, in about a month (due to my vacations).

Naomi Dushay

unread,
Jul 11, 2013, 5:15:27 PM7/11/13
to solrma...@googlegroups.com
and yes, I got rid of ALL of those warnings.

Jonathan Rochkind

unread,
Jul 11, 2013, 5:21:43 PM7/11/13
to solrma...@googlegroups.com, Naomi Dushay
So Naomi (who sent me her log4j.properties off list) -- you have both
SolrMarc itself and SolrJ logging to the same place, as they both use
log4j for logging, both use the log4j "root logger", and you set up that
root logger in the log4j.properties.

I understand that right? Cool, thanks!
Reply all
Reply to author
Forward
0 new messages