Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admin - See OGC Request parameters if an HTTP error occurred #5004

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rldhont
Copy link
Collaborator

@rldhont rldhont commented Nov 21, 2024

Follow up #4960

@rldhont rldhont added run end2end If the PR must run end2end tests or not php Pull requests that update Php code backport release_3_7 backport release_3_8 backport release_3_9 labels Nov 21, 2024
@github-actions github-actions bot added this to the 3.10.0 milestone Nov 21, 2024
Copy link
Member

@Gustry Gustry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm slightly confuse if we need these two logs at this stage, in the OGCRequest class.
As we know it's a request to QGIS server, can we not always display the full request anyway and not having these two logs ? (by stripping the QGIS server URL host part)

Related to my comment, I would have a kind helper for formating a string like {REPOSITORYID} {PROJECTID} {SERVICE} {REQUEST}, it would be way quicker to debug and understand to have these parameters first displayed (if they are available), and then display all extra parameters from the map.

And also would it be displayed twice with my PR #5004 ?

Comment on lines +196 to +204
// The master error with map parameter
$params = $this->parameters();
\jLog::log('The OGC request to QGIS Server below ended with an error. Code '.$code.''.json_encode($params), 'error');

// The admin error with map parameter replaced by repository and project parameters
unset($params['map']);
$params['repository'] = $this->project->getRepository()->getKey();
$params['project'] = $this->project->getKey();
\jLog::log('An HTTP request ended with an error, please check the main error log. Code '.$code.''.json_encode($params), 'lizmapadmin');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// The master error with map parameter
$params = $this->parameters();
\jLog::log('The OGC request to QGIS Server below ended with an error. Code '.$code.''.json_encode($params), 'error');
// The admin error with map parameter replaced by repository and project parameters
unset($params['map']);
$params['repository'] = $this->project->getRepository()->getKey();
$params['project'] = $this->project->getKey();
\jLog::log('An HTTP request ended with an error, please check the main error log. Code '.$code.''.json_encode($params), 'lizmapadmin');
$repositoryId = $this->project->getRepository()->getKey();
$projectId = $this->project->getKey();
// The master error with map parameter
$params = $this->parameters();
\jLog::log('The OGC request to QGIS Server, targeting the project "'.$projectId.'" in the repository "'.$repositoryId.'", ended with an error. Code '.$code.''.json_encode($params), 'error');
// The admin error with map parameter replaced by repository and project parameters
unset($params['map']);
$params['repository'] = $repositoryId;
$params['project'] = $projectId;
\jLog::log('An OGC HTTP request to QGIS Server, targeting the project "'.$projectId.'" in the repository "'.$repositoryId.'", ended with an error, please check the main error log. Code '.$code.''.json_encode($params), 'lizmapadmin');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport release_3_7 backport release_3_8 backport release_3_9 php Pull requests that update Php code run end2end If the PR must run end2end tests or not
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants