On our CRM v8.2 On Prem system we have numerous plugins running async, and part of the process is creating a log of changes then writing them to a log entity. I know we can use the built in plugin logging, but we also need to write to a separate entity for other reasons. Anyway I basically create a string and write to it throughout the plugin, then in the end it gets written to the log. What I'm finding is that if the plugin runs multiple times the log gets jumbled up, so the log of many runs is saved to the same record, just concatenated together. The problem I'm running into now is if I bulk load data and this plugin runs hundreds or thousands of times and the queue builds up with many async plugins to run the log gets so large it can't write. We never saw this in testing as we only tested one at a time, but now with so many running together as bulk load or just many at once in Production as the processes are used I'm seeing the logs jumble up.
I will update the plugin to clear the log variable after each run, but why would this be happening? I would think each run would be encapsulated within itself, but that doesn't appear to be the case. Just trying to make since of what's happening. Thanks.