-
Notifications
You must be signed in to change notification settings - Fork 625
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
Resource level filter logging feature added #12106
Conversation
…od and resourcePath properties.
…el and resource level.
… non revision apis only.
…ResoureLevelFilterLogging
…e resource log level
…out resourcePath.
(cherry picked from commit 626eeb6)
(cherry picked from commit db93dd8)
(cherry picked from commit 1f8e1db)
(cherry picked from commit b8cb215)
formatted logging related sql scripts
@@ -494,6 +494,7 @@ public enum ExceptionCodes implements ErrorHandler { | |||
LOGGING_API_NOT_FOUND(901400, "Requested Resource Not Found", 404, "Request API Not Found for context: %s"), | |||
LOGGING_API_INCORRECT_LOG_LEVEL(901401, "Bad Request", 400, "Log level should be either OFF, BASIC, STANDARD or FULL"), | |||
LOGGING_API_MISSING_DATA(901402, "Missing data", 400, "API context or log level is missing"), | |||
LOGGING_API_RESOURCE_NOT_FOUND(901403, "Requested Resource Not Found", 400, "Requested API Resource Not Found"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
404 for not found
resourcePath = apiLoggerObject.getString("resourcePath"); | ||
} | ||
Map<String, String> properties = new HashMap<>(); | ||
properties.put("context", apiLoggerObject.getString("context")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use constants and refer. There are many places referring to string like context
, resourcePath
, etc
import org.apache.synapse.core.axis2.Axis2MessageContext; | ||
import org.wso2.carbon.apimgt.gateway.APIMgtGatewayConstants; | ||
import org.wso2.carbon.apimgt.impl.APIConstants; | ||
|
||
import java.util.Map; | ||
import java.util.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better not to use wild card imports. Importing specific class improves readability
Map<String, String> key = entry.getKey(); | ||
//if resource path is empty, proceeding with API level logs | ||
if (selectedApi.getContext().equals(key.get("context"))) { | ||
if (key.get("resourcePath") == null && key.get("resourceMethod") == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use constants previously defined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why a dependency is added here?
Closing as the changes are added from PR [1]. [1] #12288 |
Fix wso2/api-manager#1564
Test Case for this PR: wso2/product-apim#13260