I also had another question regarding logging. Since the applicaiton log files will be a shared resource in the
java code (logging class stored in ServletContext), what is the best way to protect it? I know it should probably be made thread-safe, but what's the best way to do it? Synchronize on the file, the method doing the writing, the class, where?
At the moment I'm planning on having a factory class that will allow multiple logger types to be registered with it, but maintaining only one copy of each logger type (singleton?). I know the factory needs to be a singleton, but does each logger type need to be singleton as well? The only time you can get a refernece to a logger type is by asking the factory for one, and it makes sure that only one logger is registered for each type (by logger class name).
To those who talk about poor performance using RMI, do you have any good alternate suggestions? Or are there ways to speed it up like compressing the messages before sending, or would the compression CPU overhead outweigh the network transmission cost?
Last, any suggestions for file-writing optimization for performance? Anyone have any good thread-safe file-writing code that screams? It's all simple text output.
Thanks all you experts out there!