You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by GitBox <gi...@apache.org> on 2022/01/15 12:23:58 UTC

[GitHub] [logging-log4j2] garydgregory commented on a change in pull request #703: fix deleteAction can't distinguish basePath of symbolicLink

garydgregory commented on a change in pull request #703:
URL: https://github.com/apache/logging-log4j2/pull/703#discussion_r785303041



##########
File path: log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/AbstractPathAction.java
##########
@@ -103,7 +103,15 @@ public boolean execute(final FileVisitor<Path> visitor) throws IOException {
      * @return the base path (all lookups resolved)
      */
     public Path getBasePath() {
-        return Paths.get(subst.replace(getBasePathString()));
+        Path path = Paths.get(subst.replace(getBasePathString()));
+        if (Files.isSymbolicLink(path)) {
+            try {
+                path = Files.readSymbolicLink(path);
+            } catch (IOException e) {
+                e.printStackTrace();

Review comment:
       Printing the stack trace is a no-no. Either recover from the problem, propagate, or log to the status logger, I'm not sure which is best here.




-- 
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