File Appender writes on Mac but not windows #5028
Replies: 3 comments
-
Hi, thanks for the submission. I'm not aware of such a bug yet. It's not very easy to follow your description without code, so an example would be helpful. Nevertheless I'm not sure this is an issue in the Dropwizard framework, as this seems to be more related to Logback's implementation. If I understand your explanation correctly, you bypass most of our code and delegate to the superclasses, which reside in the Logback implementation. In this case you could better try asking there for a more helpful answer. However, if I misunderstood this, please provide a code example showing the bug. As far as I know, log messages are created but not logged only if the appender is not started. But then it wouldn't work on Mac with the same jar. |
Beta Was this translation helpful? Give feedback.
-
I agree that I have not provided much information (as building up a simple bug report is a big deal and if the problem is on my side then I have wasted everyone's time). I was just trying to make sure there was nothing obvious. Having done some further research, I think that this is an issue in file locking caused by Logbacks "safeWrite" feature and how various OS's treat files (and the location). I am going to mark this bug report closed and I apologize for the false alarm. |
Beta Was this translation helpful? Give feedback.
-
OK, the issue was that I was using a file lock on the actual log file (to make sure that the other JVMs would see the lock and then spin up their own instance log). (The current configuration does not have a way to instance current log names that I noticed, so that each JVM writes to a separate log). The Logback appender's "safeWrite" has some strange interactions with this. Meaning -- it works on Mac and not on windows. (I'm not 100% sure this is the exact culprit, but I'm fairly confident). Switching to a traditional sidecar (".lock" file) fixed the issue. Hopefully this discussion will save someone else a few hours or days in the future! |
Beta Was this translation helpful? Give feedback.
-
I have a (complex) configuration where I'm using my FIleAppenderFactory to extend RollingFileAppender so that I can parse out which messages to append. (Arguably I could do this with file filters and additive appenders, but we've got a complex enough situation where we were 90% of the way there, that it felt easier to do this, and we also do some mods of the filenames and other things, so we had a file appender factory already).
Things start up without complaint, the log files are created, I see logs coming in and I pass them to the super.doAppend in the RollingFileAppender, and it works on Mac (both from IntelliJ command line and when run via Jar). But if I take that same jar and run it on windows, the system works normally, all the expected logs are created .... but nothing ever gets written). I can see (via sysouts) the same settings getting created in my rolling file appender, and the same "I got this log, should I write it" messages my class puts out, and the calls to super.doAppend() ... but nothing?
Before I had the same issue on Mac and Windows, but that may have been because I was using a delegation model and with some methods.
Note -- I do not call the super.buildAppender() in my factory (but I just cut and pasted the relevant code) because when I called the supper.buildAppender, the logs did not write on Windows or Mac.
Are there known issues that might be causing this? If not I will submit more information for a full bug report.
Beta Was this translation helpful? Give feedback.
All reactions