I am working on an application that consists of a general Quartz-based scheduler and "CycledJob" using CronTriggers. The purpose of the application is to process data from different email mailboxes based on the source country.
Depending on the country from which it comes (for example, USA, UK, FR, etc.), the application launches one task chain to start the processing cycle of each country, so there will be a worker flow from the UK, one for the USA, France, etc. .d. When formatting the output in log4j, I use the stream parameter, so it emits [ApplicationName_Worker-1], [ApplicationName_Worker-2], etc. Try as I could, I canβt find a way to name the threads since they are derived from the Quartz Thread pools. Although I could go so far as to expand Quartz, I would like to develop a different solution instead of messing with the standard library.
Here's the problem: when using log4j, I would like all of the log entries from the US US stream to a file for the US only, also for each of the country flows. I donβt care if they stay in the same combined ConsoleAppender, the split FileAppender is what I am here. I already know how to specify several file applications, etc. My problem is that I can not differentiate by country. There are 20 classes in the application that can be in the execution chain, very few of which I want to burden with knowledge about passing an additional "context" parameter through the EVERY method ... I examined a strategy template that extends log4j, but if I cannot allow each class in the chain to know which thread he turned on to parameterize the log call, this seems impossible. Without the ability to name the stream also poses a problem (otherwise it would be easy!).
So, the question arises: what will be the proposed approach, allowing many subclasses in the application, which each of them is used for each thread, to process the input data, know that they are in the context of a particular country ceiling when they register
Good luck, and please ask clarifying questions! I hope someone can help me find a decent way to handle this. All suggestions are welcome.