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/07/30 20:59:16 UTC

[GitHub] [logging-log4j2] Dafengsu opened a new pull request, #987: [LOG4J2-3565] Fix RollingRandomAccessFileAppender with DirectWriteRol…

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

   fix [LOG4J2-3565](https://issues.apache.org/jira/browse/LOG4J2-3565)
   When you want split the log into different directories by period (day, hour, minute, etc.), and use
   RollingRandomAccessFileAppender with a DirectWrite rollover, the config should be:
   
   ``` xml
   <RollingRandomAccessFile name="RollingFile"  filePattern="${baseDir}/%d{s}/%d{s}.log">
       <PatternLayout header= "${LOG_HEADER}">
           <Pattern>${LOG_PATTERN}</Pattern>
       </PatternLayout>
       <Policies>
           <TimeBasedTriggeringPolicy/>
       </Policies>
   </RollingRandomAccessFile>
   ```
   At that time when the first log of each directory try to create, console shows;
   
   ``` shell
   2022-07-31 03:17:44,009 main ERROR RollingRandomAccessFileManager target/rolling-random-direct-switch-director/%d{s}/%d{s}.log Failed to create file after rollover: java.io.FileNotFoundException: target/rolling-random-direct-switch-director/44/44.log (No such file or directory) java.io.FileNotFoundException: target/rolling-random-direct-switch-director/44/44.log (No such file or directory)
   ```
   Apparently the directory has not been created when the file is creating


-- 
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] Dafengsu commented on pull request #987: [LOG4J2-3565] Fix RollingRandomAccessFileAppender with DirectWriteRol…

Posted by GitBox <gi...@apache.org>.
Dafengsu commented on PR #987:
URL: https://github.com/apache/logging-log4j2/pull/987#issuecomment-1200397975

   @ppkarwasz Sorry, the system I use is linux. Therefore, it is not easy to reproduce the concurrency problem of unit testing in the windows system. But I tried a solution, can you run the pipeline again?


-- 
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] Dafengsu commented on pull request #987: [LOG4J2-3565] Fix RollingRandomAccessFileAppender with DirectWriteRol…

Posted by GitBox <gi...@apache.org>.
Dafengsu commented on PR #987:
URL: https://github.com/apache/logging-log4j2/pull/987#issuecomment-1202714578

   > > Is there anything else I need to do? Sorry, my English may not be very good?sweat_smile
   > 
   > @Dafengsu: you can add an entry to `src/changes/changes.xml`. Beside that I'll wait a couple of days for other maintainers to get the chance to review your PR and I'll merge it.
   > 
   > Thank you for your contribution.
   
   @ppkarwasz  I see, thank you!


-- 
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] Dafengsu commented on a diff in pull request #987: [LOG4J2-3565] Fix RollingRandomAccessFileAppender with DirectWriteRol…

Posted by GitBox <gi...@apache.org>.
Dafengsu commented on code in PR #987:
URL: https://github.com/apache/logging-log4j2/pull/987#discussion_r933942533


##########
log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingRandomAppenderDirectWriteAndSwitchDirectorTest.java:
##########
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.core.appender.rolling;
+
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.junit.LoggerContextRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.RuleChain;

Review Comment:
   Ok, it has been rewritten, please review again



-- 
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 #987: [LOG4J2-3565] Fix RollingRandomAccessFileAppender with DirectWriteRol…

Posted by GitBox <gi...@apache.org>.
ppkarwasz commented on code in PR #987:
URL: https://github.com/apache/logging-log4j2/pull/987#discussion_r933930634


##########
log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingRandomAppenderDirectWriteAndSwitchDirectorTest.java:
##########
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.core.appender.rolling;
+
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.junit.LoggerContextRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.RuleChain;

Review Comment:
   We are trying to migrate from JUnit 4 to JUnit 5. Could you rewrite the test with JUnit 5?



-- 
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] Dafengsu commented on pull request #987: [LOG4J2-3565] Fix RollingRandomAccessFileAppender with DirectWriteRol…

Posted by GitBox <gi...@apache.org>.
Dafengsu commented on PR #987:
URL: https://github.com/apache/logging-log4j2/pull/987#issuecomment-1202659318

   Hi, @garydgregory  @carterkozak ,  Please take some time to review this PR, Thanks!


-- 
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] Dafengsu commented on pull request #987: [LOG4J2-3565] Fix RollingRandomAccessFileAppender with DirectWriteRol…

Posted by GitBox <gi...@apache.org>.
Dafengsu commented on PR #987:
URL: https://github.com/apache/logging-log4j2/pull/987#issuecomment-1202709537

   
   > > Is there anything else I need to do? Sorry, my English may not be very good?sweat_smile
   > 
   > @Dafengsu: you can add an entry to `src/changes/changes.xml`. Beside that I'll wait a couple of days for other maintainers to get the chance to review your PR and I'll merge it.
   > 
   > Thank you for your contribution.
   I see, thank you!


-- 
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 merged pull request #987: [LOG4J2-3565] Fix RollingRandomAccessFileAppender with DirectWriteRol…

Posted by GitBox <gi...@apache.org>.
ppkarwasz merged PR #987:
URL: https://github.com/apache/logging-log4j2/pull/987


-- 
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] Dafengsu commented on pull request #987: [LOG4J2-3565] Fix RollingRandomAccessFileAppender with DirectWriteRol…

Posted by GitBox <gi...@apache.org>.
Dafengsu commented on PR #987:
URL: https://github.com/apache/logging-log4j2/pull/987#issuecomment-1204267731

   > > Is there anything else I need to do? Sorry, my English may not be very good?sweat_smile
   > 
   > @Dafengsu: you can add an entry to `src/changes/changes.xml`. Beside that I'll wait a couple of days for other maintainers to get the chance to review your PR and I'll merge it.
   > 
   > Thank you for your contribution.
   Had add an entry to src/changes/changes.xml, may need re-run workflows.


-- 
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] Dafengsu commented on pull request #987: [LOG4J2-3565] Fix RollingRandomAccessFileAppender with DirectWriteRol…

Posted by GitBox <gi...@apache.org>.
Dafengsu commented on PR #987:
URL: https://github.com/apache/logging-log4j2/pull/987#issuecomment-1202667415

   > Looks good to me.
   Is there anything else I need to do? Sorry, my English may not be very good?😅


-- 
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] Dafengsu commented on pull request #987: [LOG4J2-3565] Fix RollingRandomAccessFileAppender with DirectWriteRol…

Posted by GitBox <gi...@apache.org>.
Dafengsu commented on PR #987:
URL: https://github.com/apache/logging-log4j2/pull/987#issuecomment-1204268249

   > > Is there anything else I need to do? Sorry, my English may not be very good?sweat_smile
   > 
   > @Dafengsu: you can add an entry to `src/changes/changes.xml`. Beside that I'll wait a couple of days for other maintainers to get the chance to review your PR and I'll merge it.
   > 
   > Thank you for your contribution.
   
   Had add an entry to src/changes/changes.xml, may need re-run workflows.


-- 
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 pull request #987: [LOG4J2-3565] Fix RollingRandomAccessFileAppender with DirectWriteRol…

Posted by GitBox <gi...@apache.org>.
ppkarwasz commented on PR #987:
URL: https://github.com/apache/logging-log4j2/pull/987#issuecomment-1202696885

   > Is there anything else I need to do? Sorry, my English may not be very good?sweat_smile
   
   @Dafengsu: you can add an entry to `src/changes/changes.xml`. Beside that I'll wait a couple of days for other maintainers to get the chance to review your PR and I'll merge it.
   
   Thank you for your contribution.
   
   


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