lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralph Goers (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SOLR-11453) Create separate logger for slow requests
Date Sun, 06 May 2018 19:14:00 GMT

    [ https://issues.apache.org/jira/browse/SOLR-11453?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16465259#comment-16465259
] 

Ralph Goers commented on SOLR-11453:
------------------------------------

The Log4j ScriptManager makes the Log4j Configuration and StatusLogger available to every
script. Other variables are added to the bindings depending on when the script will run. In
the case of ScriptAppenderSelector only the default bindings are available (there is no logEvent
when that script is run - it happens during logging configuration). If you were looking at
the example at http://logging.apache.org/log4j/2.x/manual/configuration.html#Scripts, it is
determining which Pattern to use for a particular log event, so that script is called for
every log event. You can see what parameters a ScriptFilter is passed by looking at https://github.com/apache/logging-log4j2/blob/master/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/ScriptFilter.java
or http://logging.apache.org/log4j/2.x/manual/filters.html#Script.

As far as the best script language goes, the Javascript engine is included in the JDK so it
is always available, but it doesn't compile to byte code so its performance won't be the best.
For something that will only execute once at configuration that probably doesn't matter, but
for something that will execute on every log event I would use a scripting language that compiles,
such as Groovy. 


To get a system property you would just call System.getProperty("property") in whatever syntax
the script language requires. 

> Create separate logger for slow requests
> ----------------------------------------
>
>                 Key: SOLR-11453
>                 URL: https://issues.apache.org/jira/browse/SOLR-11453
>             Project: Solr
>          Issue Type: Improvement
>          Components: logging
>    Affects Versions: 7.0.1
>            Reporter: Shawn Heisey
>            Assignee: Shawn Heisey
>            Priority: Minor
>         Attachments: SOLR-11453.patch, SOLR-11453.patch, SOLR-11453.patch, SOLR-11453.patch,
slowlog-informational.patch
>
>
> There is some desire on the mailing list to create a separate logfile for slow queries.
 Currently it is not possible to do this cleanly, because the WARN level used by slow query
logging within the SolrCore class is also used for other events that SolrCore can log.  Those
messages would be out of place in a slow query log.  They should typically stay in main solr
logfile.
> I propose creating a custom logger for slow queries, similar to what has been set up
for request logging.  In the SolrCore class, which is org.apache.solr.core.SolrCore, there
is a special logger at org.apache.solr.core.SolrCore.Request.  This is not a real class, just
a logger which makes it possible to handle those log messages differently than the rest of
Solr's logging.  I propose setting up another custom logger within SolrCore which could be
org.apache.solr.core.SolrCore.SlowRequest.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message