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

Emond Papegaaij commented on WICKET-3919:
-----------------------------------------

Unfortunately, I don't have the time at the moment to test the code. But in my 
opinion this is not the way to go. This approach has several major problems. 
First of all, writing loggers for different formatters is a lot of work, with 
lots of code duplication. Imagine you have to do this for other formats, such 
as XML or serialised objects as well. Second, it is very error prone. Escaping 
the strings for different formats is not a easy as it seems, and with formats 
like JSON you really have to watch things like commas. However, my major 
concern is that the logger has to know about every request handler that will 
ever be written.

I think the relation between the handlers and logger should be reversed. The 
handler should be responsible for providing the logger with information. This 
information should be structured in POJOs rather than flat strings. The logger 
is responsible for writing these objects to a stream in whatever format you 
like. You could even use Java Serialization.

I know it is too late for such a change to go in IRequestHandler in Wicket 1.5, 
therefore I propose the following solution:
For now, we fine tune these patches, and have them go in Wicket 1.5.
At some point in the near future (still 1.5, but probably after .0), we 
introduce a ILoggableRequestHandler and let all request handlers implement this 
interface. The current IRequestLogger infrastructure can still be used for 
this, especially with Martijn's patches, because they give access to the 
handlers themselves, rather than the logged strings.

> RequestLogger generates log entries that are not parsable
> ---------------------------------------------------------
>
>                 Key: WICKET-3919
>                 URL: https://issues.apache.org/jira/browse/WICKET-3919
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 1.5-RC5.1
>            Reporter: Martijn Dashorst
>         Attachments: JsonAndImprovedRequestLogger.txt, RequestLoggerTest.java
>
>
> The current (default) request logger generates logs that are not parsable by 
> automated tools. The identifiers and values give many collisions with 
> keywords, making it impossible to create an efficient ANTLR parser/lexer for 
> it.
> A couple of observations:
>  - the log is not parsable due to inconsistent logging of log parts. For 
> example [ResourceStreamRequestTarget[[]] generates an unbalanced number of 
> brackets
>  - some parts are joined by ',' and others are joined by ', ' (notice the 
> extra whitespace)
>  - it is not possible to retrieve parts of the logs because keywords, 
> identifiers and values share the same namespace. A page parameter with name 
> 'event' would choke a LL(x) parser since the lexer will render a keyword 
> instead of a value
> Possible solutions:
>  - fix the current format to become consistent and parsable, by surrounding 
> identifiers and values with single quotes and escaping single quotes inside 
> the identifiers and values, and fixing other issues
>  - render JSON instead of the current format (in my opinion best done in a 
> separate JSonRequestLogger)
>  - ???

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to