I have an application with several “controllers,” and I would like each log to be in their own file. This is easy enough for their own code, but I also use some library code that uses community logging. Can I somehow get this code to enter a controller-specific file?
I thought I could somehow do it adrift:
class Controller {
public void action() {
setCurrentThreadLogFile(myLogFile);
try {
Library.stuff();
} finally {
restoreCurrentThreadLogFile();
}
}
}
I am currently using commons-logging for my own logging as well as log4j as a backend. But I could change this if necessary, or use a mix (perhaps this is possible as part of community logging).
, , - commons (, log4j), ?