[MAGNOLIA-6717] DirectoryWatcher logs editor temp files like "*.swp", cluttering logs Created: 13/Jul/16  Updated: 19/Oct/21

Status: Accepted
Project: Magnolia
Component/s: None
Affects Version/s: 5.4.7
Fix Version/s: None

Type: Improvement Priority: Neutral
Reporter: Bradley Andersen Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Mac OS X 10.10.5


Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:

 Description   

Watching console when I edit files in vim tells me resources were added every time I edit a file, because a .swp file is generated. Likewise tells me a resource was deleted when I actually save the file and the .swp file goes away ... are there plans to not log temp files?

2016-07-12 22:04:05,937 INFO  info.magnolia.dirwatch.DirectoryWatcher           : File resource modified at [/lightmodules/test2/dialogs/components/.text.yaml.swp]
...
... actually save the file
...
... 2016-07-12 22:04:11,201 INFO  info.magnolia.dirwatch.DirectoryWatcher           : File resource(s) deleted at [/lightmodules/test2/dialogs/components/.text.yaml.swp]


 Comments   
Comment by Christopher Zimmermann [ 13/Jul/16 ]

Does this have anything specifically to do with "magnolia.resources.watcher.sensitivity=high”?

Comment by Bradley Andersen [ 13/Jul/16 ]

I don't think so. I think the extra logging is the annoying bit, because I'm not really adding or deleting anything from resources.

Comment by Christopher Zimmermann [ 13/Jul/16 ]

OK, I removed it from description then.

Comment by Samuli Saarinen [ 18/Oct/21 ]

Commenting to a really old "issue" but I think there should be similar mechanism as in classpath observation (configured with magnolia.resources.classpath.observation.pattern) as magnolia.resources.filesystem.observation.excludedDirectories only checks directories. Idea also makes temp files that cause unnecessary actions that could/should be filtered:

2021-10-18T09:53:39,200Z INFO [pool-2-thread-1] info.magnolia.dirwatch.DirectoryWatcher: File resource added at [..redacted\includes\pageAreas.yaml~] 

This is with magnolia 6.2.12

Comment by Samuli Saarinen [ 19/Oct/21 ]

Also related to temp files I see exceptions like these once in a while when temp files are cleaned up:

java.lang.IllegalArgumentException: <redacted path>\includes\pageAreas.yaml~ is neither or both a directory and/or a file.
	at com.google.common.base.Preconditions.checkArgument(Preconditions.java:217) ~[guava-30.1-jre.jar:?]
	at info.magnolia.resourceloader.file.FileSystemResourceOrigin.newResource(FileSystemResourceOrigin.java:284) ~[magnolia-resource-loader-6.2.12.jar:?]
	at info.magnolia.resourceloader.file.FileSystemResourceOrigin.getByPath(FileSystemResourceOrigin.java:131) ~[magnolia-resource-loader-6.2.12.jar:?]
	at info.magnolia.resourceloader.file.FileSystemResourceOrigin.getByPath(FileSystemResourceOrigin.java:73) ~[magnolia-resource-loader-6.2.12.jar:?]
	at info.magnolia.resourceloader.layered.LayeredResourceOrigin.lambda$getByPath$1(LayeredResourceOrigin.java:111) ~[magnolia-resource-loader-6.2.12.jar:?]
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[?:?]
	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177) ~[?:?]
	at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) ~[?:?]
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[?:?]
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[?:?]
	at info.magnolia.resourceloader.layered.LayeredResourceOrigin.getByPath(LayeredResourceOrigin.java:112) ~[magnolia-resource-loader-6.2.12.jar:?]
	at info.magnolia.resourceloader.layered.LayeredResourceOrigin$RelayingChangeHandler.onResourceChanged(LayeredResourceOrigin.java:274) ~[magnolia-resource-loader-6.2.12.jar:?]
	at info.magnolia.resourceloader.AbstractResourceOrigin.dispatchResourceChange(AbstractResourceOrigin.java:132) ~[magnolia-resource-loader-6.2.12.jar:?]
	at info.magnolia.resourceloader.file.FileWatcherCallback.dispatchResourceChange(FileWatcherCallback.java:118) ~[magnolia-resource-loader-6.2.12.jar:?]
	at info.magnolia.resourceloader.file.FileWatcherCallback.added(FileWatcherCallback.java:78) ~[magnolia-resource-loader-6.2.12.jar:?]
	at info.magnolia.dirwatch.DirectoryWatcher.processEvent(DirectoryWatcher.java:299) ~[magnolia-resource-loader-6.2.12.jar:?]
	at info.magnolia.dirwatch.DirectoryWatcher.run(DirectoryWatcher.java:247) [magnolia-resource-loader-6.2.12.jar:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
	at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264) [?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
	at java.lang.Thread.run(Thread.java:829) [?:?]
Generated at Mon Feb 12 04:17:10 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.