Hi. i would like to have log4j configured so that each logger is appended to a different file.
The filename would be based on logger's name, with dots replaced by file-separator. For instance, the logger named "aplic.dada.x1" would go to "/MYLOGDIR/aplic/dada/x1.log" It would be nice to have an appender "FileTreeAppender" with this funcionality. Then i would configure the root logger to use this appender. Acorddingly to log4j rules, all other loggers would inherit this appender. But this wouldn't work, because all loggers would use the same instance of FileTreeAppender, but i want their outputs to go to different files. One solution would be the "FileTreeAppender.doAppend" method choose the file based in LoggingEvent.getLoggerName(), but this would be very slow. So i think i will have to dinamically create an FileAppender for each Logger. I would like to ask if there is a way to automatically do this, each time someone calls Logger.getLogger. I saw that one solution was to define LoggerFactory. But the API says: "The usage of custom logger factories is discouraged and no longer documented." can someone point to better solutions? thanks daniel __________________________________________________ Esta mensagem e quaisquer ficheiros anexos são confidenciais, destinando-se ao uso exclusivo da pessoa e/ou entidade a que se dirigem. Caso não se lhe destine, ou não seja responsável pelo seu encaminhamento ao destinatário, informamos que a recebeu por engano. Qualquer utilização, distribuição, reencaminhamento ou outra forma de revelação a terceiros, impressão ou cópia são expressamente proibidos; sendo que agradecemos que destrua a mensagem de imediato, informando o seu emissor ou o Finibanco do sucedido. Não obstante o Finibanco utilizar software anti-vírus como precaução, não é possível garantir que a presente mensagem e eventuais ficheiros anexos não contêm vírus, pelo que não consideramos da responsabilidade desta instituição eventuais consequências inerentes. Alerta-se, ainda, que as mensagens transmitidas por este meio podem ser interceptadas, corrompidas, perdidas, destruídas ou entregues com atraso ao destinatário.
