You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Chetan Mehrotra (JIRA)" <ji...@apache.org> on 2016/02/15 15:36:18 UTC

[jira] [Commented] (SLING-5505) Allow recording of caller stacktrace with the logs

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

Chetan Mehrotra commented on SLING-5505:
----------------------------------------

Done with 1729650

*Usage*

The tracer config header now supports 2 new attributes

{code}
Sling-Tracer-Config : org.apache.jackrabbit.oak.query.QueryImpl;level=DEBUG;caller=true
{code}

* {{caller}} - It can have following value
** {{true}} - Complete call stack for that logger would be included
** <depth> - Call stack upto _depth_ would be included e.g. _caller=5_
* {{caller-exclude-filter}} (optional) - '|' separated  package prefixes which should *not* be included in the output. e.g. _ org.apache.jackrabbit.oak.query.QueryImpl;caller=28;caller-exclude-filter="org.eclipse|org.felix"_ - this would exclude eclipse and felix packages from the resulting stack

*Output*
Resulting output look like below

{code:javascript}
{
      "timestamp": 1455527053645,
      "level": "DEBUG",
      "logger": "org.apache.jackrabbit.oak.query.QueryImpl",
      "message": "cost for property is Infinity",
      "caller": [
        "org.apache.jackrabbit.oak.query.QueryImpl.logDebug(QueryImpl.java:900)",
        "org.apache.jackrabbit.oak.query.QueryImpl.getBestSelectorExecutionPlan(QueryImpl.java:869)",
        "org.apache.jackrabbit.oak.query.QueryImpl.getBestSelectorExecutionPlan(QueryImpl.java:795)",
        "org.apache.jackrabbit.oak.query.ast.SelectorImpl.prepare(SelectorImpl.java:284)",
        "org.apache.jackrabbit.oak.query.QueryImpl.prepare(QueryImpl.java:570)",
        "org.apache.jackrabbit.oak.query.QueryEngineImpl.executeQuery(QueryEngineImpl.java:183)",
        "org.apache.jackrabbit.oak.jcr.query.QueryManagerImpl.executeQuery(QueryManagerImpl.java:132)",
        "org.apache.jackrabbit.oak.jcr.query.QueryImpl$2.perform(QueryImpl.java:104)",
        "org.apache.jackrabbit.oak.jcr.query.QueryImpl$2.perform(QueryImpl.java:100)",
        "org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.perform(SessionDelegate.java:200)",
        "org.apache.jackrabbit.oak.jcr.query.QueryImpl.execute(QueryImpl.java:99)",
      ]
    }
{code}


> Allow recording of caller stacktrace with the logs
> --------------------------------------------------
>
>                 Key: SLING-5505
>                 URL: https://issues.apache.org/jira/browse/SLING-5505
>             Project: Sling
>          Issue Type: Sub-task
>          Components: Extensions
>            Reporter: Chetan Mehrotra
>            Assignee: Chetan Mehrotra
>             Fix For: Log Tracer 1.0.0
>
>
> At times we need to determine which code has invoked a given query. For those cases the tracer should provide an option to optionally dump the caller stack upto certain depth. This would be similar to [1]
> [1] http://logback.qos.ch/manual/layouts.html#caller



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)