You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Nawab Zada Asad Iqbal <kh...@gmail.com> on 2017/07/27 16:57:55 UTC

logging support in Lucene code

Hi,

I see a lot of discussion on this topic from almost 10 years ago: e.g.,
https://issues.apache.org/jira/browse/LUCENE-1482

For 4.5, I relied on 'System.out.println' for writing information for
debugging in production.

In 6.6, I notice that some classes in Lucene are instantiating a Logger,
should I use Logger instead? I tried to log with it, but I don't see any
output in logs.


Regards
Nawab

Re: logging support in Lucene code

Posted by Nawab Zada Asad Iqbal <kh...@gmail.com>.
Thanks Shalin
I actually had that config true, so it seems that I may not be exercising
the right scenario to execute that logline.

On Fri, Jul 28, 2017 at 1:47 AM, Shalin Shekhar Mangar <
shalinmangar@gmail.com> wrote:

> Lucene does not use a logger framework. But if you are using Solr then you
> can route the infoStream logging to Solr's log files by setting an option
> in the solrconfig.xml. See
> http://lucene.apache.org/solr/guide/6_6/indexconfig-in-solrconfig.html#
> IndexConfiginSolrConfig-OtherIndexingSettings
>
> On Fri, Jul 28, 2017 at 11:13 AM, Nawab Zada Asad Iqbal <kh...@gmail.com>
> wrote:
>
> > Any doughnut for me ?
> >
> >
> > Regards
> > Nawab
> >
> > On Thu, Jul 27, 2017 at 9:57 AM Nawab Zada Asad Iqbal <kh...@gmail.com>
> > wrote:
> >
> > > Hi,
> > >
> > > I see a lot of discussion on this topic from almost 10 years ago: e.g.,
> > > https://issues.apache.org/jira/browse/LUCENE-1482
> > >
> > > For 4.5, I relied on 'System.out.println' for writing information for
> > > debugging in production.
> > >
> > > In 6.6, I notice that some classes in Lucene are instantiating a
> Logger,
> > > should I use Logger instead? I tried to log with it, but I don't see
> any
> > > output in logs.
> > >
> > >
> > > Regards
> > > Nawab
> > >
> >
>
>
>
> --
> Regards,
> Shalin Shekhar Mangar.
>

Re: logging support in Lucene code

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
Lucene does not use a logger framework. But if you are using Solr then you
can route the infoStream logging to Solr's log files by setting an option
in the solrconfig.xml. See
http://lucene.apache.org/solr/guide/6_6/indexconfig-in-solrconfig.html#IndexConfiginSolrConfig-OtherIndexingSettings

On Fri, Jul 28, 2017 at 11:13 AM, Nawab Zada Asad Iqbal <kh...@gmail.com>
wrote:

> Any doughnut for me ?
>
>
> Regards
> Nawab
>
> On Thu, Jul 27, 2017 at 9:57 AM Nawab Zada Asad Iqbal <kh...@gmail.com>
> wrote:
>
> > Hi,
> >
> > I see a lot of discussion on this topic from almost 10 years ago: e.g.,
> > https://issues.apache.org/jira/browse/LUCENE-1482
> >
> > For 4.5, I relied on 'System.out.println' for writing information for
> > debugging in production.
> >
> > In 6.6, I notice that some classes in Lucene are instantiating a Logger,
> > should I use Logger instead? I tried to log with it, but I don't see any
> > output in logs.
> >
> >
> > Regards
> > Nawab
> >
>



-- 
Regards,
Shalin Shekhar Mangar.

Re: logging support in Lucene code

Posted by Nawab Zada Asad Iqbal <kh...@gmail.com>.
Any doughnut for me ?


Regards
Nawab

On Thu, Jul 27, 2017 at 9:57 AM Nawab Zada Asad Iqbal <kh...@gmail.com>
wrote:

> Hi,
>
> I see a lot of discussion on this topic from almost 10 years ago: e.g.,
> https://issues.apache.org/jira/browse/LUCENE-1482
>
> For 4.5, I relied on 'System.out.println' for writing information for
> debugging in production.
>
> In 6.6, I notice that some classes in Lucene are instantiating a Logger,
> should I use Logger instead? I tried to log with it, but I don't see any
> output in logs.
>
>
> Regards
> Nawab
>

Re: logging support in Lucene code

Posted by Nawab Zada Asad Iqbal <kh...@gmail.com>.
Thanks Shawn for the detailed context.
I saw some Logger (java.util.logging) in one class in lucene folder, hence
I thought that logging is now properly supported. Since, i am using solr
(and indirectly lucene), I will use whatever solr is using.

Not depending on any concrete logger is good for lucene, as it is included
in other projects too.


Regards
Nawab

On Fri, Jul 28, 2017 at 6:57 AM, Shawn Heisey <ap...@elyograg.org> wrote:

> On 7/27/2017 10:57 AM, Nawab Zada Asad Iqbal wrote:
> > I see a lot of discussion on this topic from almost 10 years ago: e.g.,
> > https://issues.apache.org/jira/browse/LUCENE-1482
> >
> > For 4.5, I relied on 'System.out.println' for writing information for
> > debugging in production.
> >
> > In 6.6, I notice that some classes in Lucene are instantiating a Logger,
> > should I use Logger instead? I tried to log with it, but I don't see any
> > output in logs.
>
> You're asking about this on a Solr list, not a Lucene list.  I am not
> subscribed to the main Lucene user list, so I do not know if you have
> also sent this question to that list.
>
> Solr uses slf4j for logging.  Many of its dependencies have chosen other
> logging frameworks.
>
> https://www.slf4j.org/
>
> With slf4j, you can utilize just about any supported logging
> implementation to do the actual end logging.  The end implementation
> chosen by the Solr project for version 4.3 and later is log4j 1.x.
>
> It is my understanding that Lucene's core module has zero dependencies
> -- it's pure Java.  That would include any external logging
> implementation.  I do not know if the core module even uses
> java.util.logging ... a quick grep for "Logger" suggests that there are
> no loggers in use in the core module at all, but it's possible that I
> have not scanned for the correct text.  I did notice that
> TestIndexWriter uses a PrintStream for logging, and Shalin's reply has
> reminded me about the infoStream feature.
>
> Looking at the source code, it does appear that some of the other Lucene
> modules do use a logger. Some of them appear to use the logger built
> into java, others seem to use one of the third-party implementations
> like slf4j.  Some of the dependent jars pulled in for non-core Lucene
> modules depend on various logging implementations.
>
> Logging frameworks can be the center of a religious flamewar.  Opinions
> run strong.  IMHO, if you are writing your own code, the best option is
> slf4j, bound to whatever end logging implementation you are most
> comfortable using.  You can install slf4j jars to intercept logging sent
> to the other common logging implementations and direct those through
> slf4j so they end up in the same place as everything else.
>
> Note if you want to use log4j2 as your end logging destination with
> slf4j: log4j2 comes with jars implementing the slf4j classes, so you're
> probably going to want to use those.
>
> Thanks,
> Shawn
>
>

Re: logging support in Lucene code

Posted by Shawn Heisey <ap...@elyograg.org>.
On 7/27/2017 10:57 AM, Nawab Zada Asad Iqbal wrote:
> I see a lot of discussion on this topic from almost 10 years ago: e.g.,
> https://issues.apache.org/jira/browse/LUCENE-1482
>
> For 4.5, I relied on 'System.out.println' for writing information for
> debugging in production.
>
> In 6.6, I notice that some classes in Lucene are instantiating a Logger,
> should I use Logger instead? I tried to log with it, but I don't see any
> output in logs.

You're asking about this on a Solr list, not a Lucene list.  I am not
subscribed to the main Lucene user list, so I do not know if you have
also sent this question to that list.

Solr uses slf4j for logging.  Many of its dependencies have chosen other
logging frameworks.

https://www.slf4j.org/

With slf4j, you can utilize just about any supported logging
implementation to do the actual end logging.  The end implementation
chosen by the Solr project for version 4.3 and later is log4j 1.x.

It is my understanding that Lucene's core module has zero dependencies
-- it's pure Java.  That would include any external logging
implementation.  I do not know if the core module even uses
java.util.logging ... a quick grep for "Logger" suggests that there are
no loggers in use in the core module at all, but it's possible that I
have not scanned for the correct text.  I did notice that
TestIndexWriter uses a PrintStream for logging, and Shalin's reply has
reminded me about the infoStream feature.

Looking at the source code, it does appear that some of the other Lucene
modules do use a logger. Some of them appear to use the logger built
into java, others seem to use one of the third-party implementations
like slf4j.  Some of the dependent jars pulled in for non-core Lucene
modules depend on various logging implementations.

Logging frameworks can be the center of a religious flamewar.  Opinions
run strong.  IMHO, if you are writing your own code, the best option is
slf4j, bound to whatever end logging implementation you are most
comfortable using.  You can install slf4j jars to intercept logging sent
to the other common logging implementations and direct those through
slf4j so they end up in the same place as everything else.

Note if you want to use log4j2 as your end logging destination with
slf4j: log4j2 comes with jars implementing the slf4j classes, so you're
probably going to want to use those.

Thanks,
Shawn