[ 
https://issues.apache.org/jira/browse/SLING-688?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Renaud Richardet updated SLING-688:
-----------------------------------

    Attachment: RequestProgressTrackerLogFilter.java.diff

Here's an updated patch. It includes most of the remarks of Felix and Bertrand 
(see below). 

Still, there's a bug in deepGetOrCreateNode() at node.addNode(name, 
"nt:resource"): javax.jcr.nodetype.ConstraintViolationException: no definition 
found in parent node's node type for new node: no matching child node 
definition found for {}163617_318
Why isn't it possible to create a nt:resource under a nt:folder? I must be 
missing something...

> * You should set the response header early in the request, because the 
> response might already be committed at the end of the request and the header 
> may not get through
Done

> * I would prefix the header name with "X-" to mark it as a non-standard header
Done

> * I would make the root location for the persistence configurable (using 
> @scr.property tags). A default location would be below /var, eg. 
> /var/log/requestprogress
Makes sense. So, how can I retrieve the property value from within the class? 
Do I need something like a BundleContext or so? The Felix-doc [1] also mentions 
ComponentContext.getProperties(), but I can't get it to work... 

> * The same holds for whether to persist or not. OTOH assumming persistence in 
> case of enabled debug log seems reasonable.
Agreed

> Ok but I would still log the messages, to be able to use both mechanisms: 
> logging or browser display.
Ok, done

> Also, I would put the full path of the logging node in the response header, 
> and make that a "chronological path" like /somewhere/YYYY/MM/DD/... to be 
> able to cleanup old debugging logs easily.
Done in getChronologicalPath(). Should it be configurable?

> (I think we need a Sling utility to create such paths BTW, they might be a 
> good option when creating nodes via SlingPostServlet. But that's another 
> story.)
OK, for now the 2 methods (getChronologicalPath() and deepGetOrCreateNode()) 
are inside RequestProgressTrackerLogFilter. 
BTW, deepGetOrCreateNode() comes from WebloaderJob.getAndStoreDocument() and 
ModifyOperation.deepGetOrCreateNode().

cheers, Renaud

[1] http://felix.apache.org/site/apache-felix-maven-scr-plugin.html

> Log request processing steps in repository to make it accesible to the 
> generated html page
> ------------------------------------------------------------------------------------------
>
>                 Key: SLING-688
>                 URL: https://issues.apache.org/jira/browse/SLING-688
>             Project: Sling
>          Issue Type: Improvement
>          Components: Engine
>         Environment: Ubuntu64, java6
>            Reporter: Renaud Richardet
>         Attachments: RequestProgressTrackerLogFilter.java.diff
>
>
> This is an extension to SLING-3 and follow-up comments 
> (http://markmail.org/message/mbb7sw4cqzun6fa2). The idea is to log request 
> processing steps and make them available to the generated HTML page (to make 
> it easier to understand how the page was generated). 2-steps process:
> 1) in RequestProgressTrackerLogFilter, save debug information (in a JCR node, 
> e.g. at /var/log/requestprogress/YYYY/MM/DD/ms), add nodePath in response (as 
> parameter)
> 2) add small js script on html page that gets debug information via AJAX 
> (using nodePath param)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to