You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "adwsingh (via GitHub)" <gi...@apache.org> on 2023/02/16 09:51:04 UTC

[GitHub] [logging-log4j2] adwsingh opened a new pull request, #1277: Moving away from PARAM_VALUE_ESCAPE_PATTERN in Rfc5424Layout

adwsingh opened a new pull request, #1277:
URL: https://github.com/apache/logging-log4j2/pull/1277

   Moving away from PARAM_VALUE_ESCAPE_PATTERN in Rfc5424Layout to manually checking for es-capable characters. Fixes #1224 
   
   ## Checklist
   
   * `./mvnw verify` succeeds (if it fails due to code formatting issues reported by Spotless, simply run `spotless:apply` and retry)
   * Changes contain an entry file in the `src/changelog/.2.x.x` directory
   * Tests for the changes are provided
   * [Commits are signed](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits) (optional, but highly recommended)
   


-- 
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: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [logging-log4j2] adwsingh commented on a diff in pull request #1277: Moving away from PARAM_VALUE_ESCAPE_PATTERN in Rfc5424Layout

Posted by "adwsingh (via GitHub)" <gi...@apache.org>.
adwsingh commented on code in PR #1277:
URL: https://github.com/apache/logging-log4j2/pull/1277#discussion_r1108397150


##########
log4j-core/src/main/java/org/apache/logging/log4j/core/layout/Rfc5424Layout.java:
##########
@@ -570,7 +570,15 @@ private void appendMap(final String prefix, final Map<String, String> map, final
     }
 
     private String escapeSDParams(final String value) {
-        return PARAM_VALUE_ESCAPE_PATTERN.matcher(value).replaceAll("\\\\$0");
+        StringBuilder output = new StringBuilder();

Review Comment:
   Sure @vy . I wanted to remove `PARAM_VALUE_ESCAPE_PATTERN` but didn't because it was public.



-- 
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: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [logging-log4j2] vy commented on a diff in pull request #1277: Moving away from PARAM_VALUE_ESCAPE_PATTERN in Rfc5424Layout

Posted by "vy (via GitHub)" <gi...@apache.org>.
vy commented on code in PR #1277:
URL: https://github.com/apache/logging-log4j2/pull/1277#discussion_r1108395816


##########
log4j-core/src/main/java/org/apache/logging/log4j/core/layout/Rfc5424Layout.java:
##########
@@ -570,7 +570,15 @@ private void appendMap(final String prefix, final Map<String, String> map, final
     }
 
     private String escapeSDParams(final String value) {
-        return PARAM_VALUE_ESCAPE_PATTERN.matcher(value).replaceAll("\\\\$0");
+        StringBuilder output = new StringBuilder();

Review Comment:
   @adwsingh, could you implement the following changes as well, please?
   1. Remove the `PARAM_VALUE_ESCAPE_PATTERN` constant (reorganize the `import`s)
   2. Don't instantiate the `StringBuilder` until you encounter one of the target characters. If nothing to be escaped, i.e., `output == null`, you can simply return the `value` as is.
   3. Please stick to the coding style followed in the rest of the file; whitespace after `if`, decorate variables with `final` modifier wherever possible, etc.



-- 
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: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [logging-log4j2] vy commented on pull request #1277: Moving away from PARAM_VALUE_ESCAPE_PATTERN in Rfc5424Layout

Posted by "vy (via GitHub)" <gi...@apache.org>.
vy commented on PR #1277:
URL: https://github.com/apache/logging-log4j2/pull/1277#issuecomment-1433005426

   @adwsingh, mind adding a `src/changelog/.2.x.x/1277-replace_regexp_in_Rfc5424Layout.xml` file too, please?


-- 
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: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [logging-log4j2] vy merged pull request #1277: Moving away from PARAM_VALUE_ESCAPE_PATTERN in Rfc5424Layout

Posted by "vy (via GitHub)" <gi...@apache.org>.
vy merged PR #1277:
URL: https://github.com/apache/logging-log4j2/pull/1277


-- 
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: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [logging-log4j2] ppkarwasz commented on a diff in pull request #1277: Moving away from PARAM_VALUE_ESCAPE_PATTERN in Rfc5424Layout

Posted by "ppkarwasz (via GitHub)" <gi...@apache.org>.
ppkarwasz commented on code in PR #1277:
URL: https://github.com/apache/logging-log4j2/pull/1277#discussion_r1108434371


##########
log4j-core/src/main/java/org/apache/logging/log4j/core/layout/Rfc5424Layout.java:
##########
@@ -570,7 +570,15 @@ private void appendMap(final String prefix, final Map<String, String> map, final
     }
 
     private String escapeSDParams(final String value) {
-        return PARAM_VALUE_ESCAPE_PATTERN.matcher(value).replaceAll("\\\\$0");
+        StringBuilder output = new StringBuilder();

Review Comment:
   @vy: I agree with @adwsingh: unfortunately public constants must be kept (but can be `@Deprecated`), because this is not an internal class.



-- 
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: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org