Rishabh Daim created OAK-12439:
----------------------------------

             Summary: Restart reconfigured oak-run logging contexts to stop 
orphaned scanners
                 Key: OAK-12439
                 URL: https://issues.apache.org/jira/browse/OAK-12439
             Project: Jackrabbit Oak
          Issue Type: Bug
            Reporter: Rishabh Daim
            Assignee: Rishabh Daim


Repeated oak-run commands in one JVM leave Logback's configuration scanner 
running after shutdown. The scanner can then create indexing.log under 
oak.workDir_IS_UNDEFINED in the module directory, causing Apache RAT to fail.

h3. Cause
LoggingInitializer reconfigures a LoggerContext stopped by an earlier command 
but does not restart it. With Logback 1.6.4, LoggerContext.stop() returns 
immediately when the context is already stopped, leaving the new file appender 
and scheduled configuration scanner active. When test-scoped system properties 
are restored and a watched configuration changes or disappears, the scanner 
reloads without oak.workDir and resolves the relative fallback directory.

h3. Reproduction
# Initialize indexing logging, then shut it down.
# Initialize it again in the same JVM. The context remains stopped although a 
new scanner has been scheduled.
# Shut down again. The scheduled scanner is not cancelled.
# Restore/clear oak.workDir and modify the watched configuration. The exact 
stray log is created outside target.

This was reproduced with the project's resolved Logback 1.6.4 dependencies, 
independent of cache maintenance changes.

h3. Proposed fix and validation
Restart the reconfigured logging context so shutdown closes the appender and 
cancels its scanner. Add deterministic regression tests for repeated 
initialization/shutdown, retain the external-configuration opt-out, and verify 
generated logging artifacts stay under test-scoped build output. Do not add RAT 
exclusions for the stray log.

[Failing build on PR 
3185|https://github.com/apache/jackrabbit-oak/actions/runs/37422282668/job/112134394437]




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to