Logging 有没有办法注释solr日志?

Logging 有没有办法注释solr日志?,logging,solr,Logging,Solr,我希望代码的不同部分在Solr日志中进行注释,以便知道代码的哪些部分正在生成哪些查询 日志行当前看起来像: 信息:[collection1]webapp=/solr path=/select/params={fq=datefield:[2007-01-01T00:00:00Z+TO+2007-12-31T00:00:00Z]&fq=status:precential&fq=westCite:“509+F.3d+173”}点击次数=0状态=0 QTime=2 我更喜欢它说这样的话: &so

我希望代码的不同部分在Solr日志中进行注释,以便知道代码的哪些部分正在生成哪些查询

日志行当前看起来像:

信息:[collection1]webapp=/solr path=/select/params={fq=datefield:[2007-01-01T00:00:00Z+TO+2007-12-31T00:00:00Z]&fq=status:precential&fq=westCite:“509+F.3d+173”}点击次数=0状态=0 QTime=2

我更喜欢它说这样的话:

&source=Scraper
&source=user-query
信息:[collection1]webapp=/solr path=/select/params={fq=datefield:[2007-01-01T00:00:00Z+TO+2007-12-31T00:00:00Z]&fq=status:precential&fq=westCite:“509+F.3d+173”}点击率=0状态=0 QTime=2Source=Scraper

信息:[collection1]webapp=/solr path=/select/params={fq=datefield:[2007-01-01T00:00:00Z+TO+2007-12-31T00:00:00Z]&fq=status:precential&fq=westCite:“509+F.3d+173”}点击次数=0状态=0 QTime=2来源=用户查询

或者类似的东西


我想我可以通过在查询中使用否定来实现这一点,因此每个查询都有类似于
-source:scraper
的内容。这应该不会对查询造成太大影响(因为我缺少
源代码
字段,所以我猜这对性能的影响可以忽略不计),而且它也可以达到目的,但我希望有更好的方法。

我可以看到两种解决方案:

  • 只需添加不在任何地方使用的额外查询参数。比如:

    &source=Scraper
    &source=user-query
    
    它最终应该是:

    INFO: [collection1] webapp=/solr path=/select/ params={fq=dateFiled:[2007-01-01T00:00:00Z+TO+2007-12-31T00:00:00Z]&fq=status:Precedential&fq=westCite:"509+F.3d+173"&source=Scraper} hits=0 status=0 QTime=2
    
    INFO: [collection1] webapp=/solr path=/select/ params={fq=dateFiled:[2007-01-01T00:00:00Z+TO+2007-12-31T00:00:00Z]&fq=status:Precedential&fq=westCite:"509+F.3d+173"&source=user-query} hits=0 status=0 QTime=2
    
    (我看起来不太好,但您可以从日志中筛选您需要的内容)

  • 设置不同的查询处理程序,一个用于Scraper,另一个用于用户查询。然后,您的日志将如下所示:

    INFO: [collection1] webapp=/solr path=/scraper/ params={fq=dateFiled:[2007-01-01T00:00:00Z+TO+2007-12-31T00:00:00Z]&fq=status:Precedential&fq=westCite:"509+F.3d+173"} hits=0 status=0 QTime=2
    
    INFO: [collection1] webapp=/solr path=/user-query/ params={fq=dateFiled:[2007-01-01T00:00:00Z+TO+2007-12-31T00:00:00Z]&fq=status:Precedential&fq=westCite:"509+F.3d+173"} hits=0 status=0 QTime=2
    
  • 编写非常小的自定义插件,可以尝试向日志中添加额外信息(可能基于选项1中的信息)


  • 选项1和2不会对性能产生任何影响,而且非常容易实施。选项3可能会花费您一点时间来实现和执行(每个查询可能不到1ms)

    谢谢。看来秘密查询参数将是一条出路。