quarkus: *Rotating*LoggingTest failures on Windows

*Rotating*LoggingTest failures on Windows Module: core/test-extension/deployment

Issue with strict file locking on Windows comparing to Linux.

Maybe something can be done in https://github.com/quarkusio/quarkus/blob/master/test-framework/junit5-internal/src/main/java/io/quarkus/test/QuarkusUnitTest.java#L278, but not really sure.

First executed *Rotating*LoggingTest passes, but but I guess it keeps the file locked.

Stacktrace:

2019-05-16 10:21:55,441 ERROR [null] (main) Failed to publish log record (GENERIC_FAILURE[0]):
  Failed to move file target\quarkus.log to target\quarkus.log2019-05-16.1.: 
  java.nio.file.FileSystemException: target\quarkus.log -> target\quarkus.log2019-05-16.1:
  The process cannot access the file because it is being used by another process.

        at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:86)
        at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
        at sun.nio.fs.WindowsFileCopy.move(WindowsFileCopy.java:387)
        at sun.nio.fs.WindowsFileSystemProvider.move(WindowsFileSystemProvider.java:287)
        at java.nio.file.Files.move(Files.java:1395)
        at org.jboss.logmanager.handlers.SuffixRotator.move(SuffixRotator.java:239)
        at org.jboss.logmanager.handlers.SuffixRotator.rotate(SuffixRotator.java:167)
        at org.jboss.logmanager.handlers.PeriodicRotatingFileHandler.rollOver(PeriodicRotatingFileHandler.java:194)
        at org.jboss.logmanager.handlers.PeriodicRotatingFileHandler.preWrite(PeriodicRotatingFileHandler.java:112)
        at org.jboss.logmanager.handlers.WriterHandler.doPublish(WriterHandler.java:57)
        at org.jboss.logmanager.ExtHandler.publish(ExtHandler.java:66)
        at org.jboss.logmanager.handlers.DelayedHandler.publishToChildren(DelayedHandler.java:208)
        at org.jboss.logmanager.handlers.DelayedHandler.doPublish(DelayedHandler.java:49)
        at org.jboss.logmanager.ExtHandler.publish(ExtHandler.java:66)
        at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:316)
        at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:324)
        at org.jboss.logmanager.Logger.logRaw(Logger.java:748)
        at org.jboss.logmanager.Logger.log(Logger.java:706)
        at org.jboss.logging.JBossLogManagerLogger.doLogf(JBossLogManagerLogger.java:53)
        at org.jboss.logging.Logger.infof(Logger.java:1136)
        at io.quarkus.extest.runtime.RuntimeXmlConfigService.startService(RuntimeXmlConfigService.java:34)
        at io.quarkus.extest.runtime.TestTemplate.startRuntimeService(TestTemplate.java:65)
        at io.quarkus.deployment.steps.TestProcessor$startRuntimeService53.deploy(Unknown Source)
        at io.quarkus.runner.ApplicationImpl3.doStart(Unknown Source)
        at io.quarkus.runtime.Application.start(Application.java:100)
        at io.quarkus.runner.RuntimeRunner.run(RuntimeRunner.java:122)
        at io.quarkus.test.QuarkusUnitTest.beforeAll(QuarkusUnitTest.java:224)

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (17 by maintainers)

Most upvoted comments

Should we add it as default value for fileSuffix?

IIRC, the rotation feature is enabled if it is defined so we can’t define a default. But we could certainly improve the javadoc with an example.

@machi1990 your code proposal won’t work because of PropertyTestUtil.java as I wrote above …

Yes, quarkus.log is picked by the three tests cases. Customization of file name doesn’t work in tests. I tried to define quarkus.log.file.path=xxx.log but the log file was still quarkus.log

It’s because of PropertyTestUtil.setLogFileProperty(); in QuarkusUnitTest which sets quarkus.log.file.path to target/quarkus.log See https://github.com/quarkusio/quarkus/blob/master/test-framework/common/src/main/java/io/quarkus/test/common/PropertyTestUtil.java#L24

I added thread sleep to one test and used Process Explorer to find process which holds that file and it was surefire process, there were 3 entries for that process for that quarkus.log file.

I’m considering second constructor for QuarkusUnitTest to add log file name. Any better idea ? Scan of exported archive is possible too, but isn’t it just too much work to be done with every test?

Looking at the properties file I don’t see a file name specified. I assume it must get a default name of some sort. What the issue might be is the rotated file, whatever.logyyyy-MM-dd, is in use by something like a virus scanner so it can’t be deleted then created during the move.