How best should I setup a central logging (or perhaps 2, each one exclusive to either test or prod) server such that:
I do not have to worry about the code referencing any conditionals that might accidentally log non-prod errors into the production error log4j bus. In other words, I do not wants to have code such as:
if (!production)
logWrapper.logTest(error);
else
logWrapper.logProd(error);
I do not want this because it tightly couples something such as the server name, references it, and now the code can only work on one of two server names: prod and test. Nor can I declaratively set this in a config because of the probability that a developer will not set this correctly and pollute the logging repositories. Any Suggestions?
A few details, some aren't going to factor in but I list them anyway:
- Only web applications, running on Oracle Application Server 10.1.3.4 now, and in the future Oracle WebLogic
- going to be using a central logging server as demonstrated in this example: http://timarcher.com/?q=node/10 ...EXCEPT that the central server will log text files and not perform emailing!
- Will use log4j and maybe it will be wrapped via slf4j (the slf4j is kind of irreverent to mention so ignore it for the most part..)