You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@jena.apache.org by GitBox <gi...@apache.org> on 2022/06/22 09:00:50 UTC
[GitHub] [jena] OyvindLGjesdal opened a new issue, #1396: [Bug]: Round tripping queries from fuseki-webapp log requires manual editing if they contain comments
OyvindLGjesdal opened a new issue, #1396:
URL: https://github.com/apache/jena/issues/1396
### Version
4.10
### What happened?
A query with comments
```
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT * WHERE { #ex1
?sub ?pred ?obj .
#ex2
} LIMIT 10
```
returns a log entry which requires manual intervention and/or guessing for being parseable again.
The main issue seems to be that [SPARQLQueryProcessor.java](https://github.com/apache/jena/blob/main/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQLQueryProcessor.java#L238) calls [ServletOps.formatForLogs](https://github.com/apache/jena/blob/main/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ServletOps.java#L278) which replaces line characters with spaces (and return queries the string `<null>` where queriy is `null`) before the configuration of the log format takes place. This means that we can't override the formatting of the query string log4j2.properties for to encode new lines, for simplyfying use in debugging.
I think that removing the call to formatForLogs and moving the replacements to the configuration and fallback configuration of log4j2 makes sense.
If the default log4j2.properties and the fallback configuration log4j2setupFallback then is changed to:
```
appender.console.layout.pattern = %d{HH:mm:ss} %-5p %-15c{1} :: %replace{%m}{[\n\r]}{ }%n
```
I am then able to override the pattern in my own `log4j2.properties to return lines with `\\n\\r` in the log entry.
```
appender.console.layout.pattern = %d{HH:mm:ss} %-5p %-15c{1} :: %enc{%m}{CRLF}{ }%n
```
from (https://logging.apache.org/log4j/2.x/manual/layouts.html)
I'm unsure what to do with the `<null>` return in this scenario.
The purpose is mostly for the convenience of debugging large/slow/wrong queries found in the logs. The queries are often templated, so it is convenient to reuse the fuseki log entry, then qparse it for formatting, and then copying it to e.g fuseki gui or yasgui for experimenting.
### Which environment is running?
- [ ] macOS
- [ ] Windows
- [X] Linux
- [ ] other
### Relevant output and stacktrace
```shell
Jun 21 23:18:07 fuseki-test.novalocal fuseki-server[4067]: 23:18:07 INFO Fuseki :: [4] Query = PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT * WHERE { ?sub ?pred ?obj . #test } LIMIT 10
Jun 21 23:18:07 fuseki-test.novalocal fuseki-server[4067]: 23:18:07 WARN Fuseki :: [4] Parse error: Encountered "<EOF>" at line 1, column 169.
```
### Are you interested in making a pull request?
Yes
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org
[GitHub] [jena] afs commented on issue #1396: [Bug]: Round tripping queries from fuseki-webapp log requires manual editing if they contain comments
Posted by GitBox <gi...@apache.org>.
afs commented on issue #1396:
URL: https://github.com/apache/jena/issues/1396#issuecomment-1163518437
This is not so clear cut.
log4j2 is not the only logging system so relying on a feature in normal mode of operation excludes other (e.g. JUL).
In [SPARQLQueryProcessor.java#L238](https://github.com/afs/jena/blob/63a8f50b8434d1eea52369798a1310415d58e2ec/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQLQueryProcessor.java#L238) verbose mode switches Fusek to print the query out multi-line.
Configuring log4j2 is interesting but it loses the ability to switch based on the verbose setting. In Fuseki Main, it is useful when developing when the Fuseki server is build programmatically.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org
[GitHub] [jena] OyvindLGjesdal closed issue #1396: [Bug]: Round tripping queries from fuseki-webapp log requires manual editing if they contain comments
Posted by GitBox <gi...@apache.org>.
OyvindLGjesdal closed issue #1396: [Bug]: Round tripping queries from fuseki-webapp log requires manual editing if they contain comments
URL: https://github.com/apache/jena/issues/1396
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org
[GitHub] [jena] OyvindLGjesdal commented on issue #1396: [Bug]: Round tripping queries from fuseki-webapp log requires manual editing if they contain comments
Posted by GitBox <gi...@apache.org>.
OyvindLGjesdal commented on issue #1396:
URL: https://github.com/apache/jena/issues/1396#issuecomment-1164089940
Thanks for the pointer to verbose flag, that is a workaround that we can apply and work with.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org