Skip to content

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

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

Closed
wants to merge 1 commit into from

Conversation

rldhont
Copy link
Collaborator

@rldhont rldhont commented Nov 21, 2024

Follow up #4960

@github-actions github-actions bot added this to the 3.10.0 milestone Nov 21, 2024
@rldhont rldhont force-pushed the follow-up-http-request-error branch from 5153698 to 269cd20 Compare November 22, 2024 07:45
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');

@rldhont
Copy link
Collaborator Author

rldhont commented Dec 3, 2024

superseeded by #5066

@rldhont rldhont closed this Dec 3, 2024
@rldhont rldhont deleted the follow-up-http-request-error branch January 24, 2025 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport release_3_8 backport release_3_9 php Pull requests that update Php code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants