I have a requirement to log requests from separate clients to separate log files. So logging to a single file and then filtering that file is not an option.
I found the below in the FAQ, however I'm not sure how to implement this: 3.1 Can the outputs of multiple client request go to different log files? For select applications, such as virtual hosting web-servers, the NDC solution is not sufficient. As of version 0.9.0, log4j supports multiple hierarchy trees. Thus, it is possible to log to different targets from the same logger depending on the current context. Can someone point me in the right direction to make this multiple hierarchy tree happen? Before I came across this FAQ, I was planning to do the following programmatically as I'm not sure how to make a configuration file do this for me and yet be dynamic: 1. Create a separate Logger dynamically for a given client, if one doesn't exist for that client. E.g. if I identify the client as "client1", I could use a logger like "myapp.client1". 2. If the logger is doesn't exist and is being created, add a daily rolling file appender with a specific path name derived using the client id, to this logger. 3. Log "client1" log to "myapp.client1" and so on. I haven't looked at what the log4j APIs support but is it feasible to attempt something like this? Which classes and APIs should I be looking at? Would really appreciate some advise as I'm short of time. Thanks --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
