você pode fazer o Tomcat 6 stdout.log arquivo de se comportar como um log4j DailyRollingFileAppender?

StackOverflow https://stackoverflow.com/questions/2015273

Pergunta

Estamos usando a instalação do Windows de Tomcat 6. Por padrão, a saída log4j para nosso aplicativo vai para o {catalina.base} arquivo /logs/stdout_.log $. Esse arquivo de log única rola quando reiniciar o Tomcat, eo nome do arquivo inclui sempre a data.

Eu preferiria que ele se comporte como um DailyRollingFileAppender, onde ele muda o nome do arquivo quando ele rola ... Dessa forma eu posso apenas aberto Notepad ++ e veja os registros de hoje, uma vez Notepad ++ vai se lembrar que eu abri esse mesmo arquivo ontem. :)

Eu sei que eu posso simplesmente criar outro appender em log4j, mas eu iria acabar com a stdout.log e outro arquivo de log, e eu tenho medo que haveria um acerto de desempenho menor para o registo para ambos os arquivos. Eu tentei adicionar swallowOutput = true ao meu context.xml mas eu ainda obter todos os logs em stdout.log. Alguma idéia?

Foi útil?

Solução

Have you tried the steps outlined in Logging in Tomcat? If you follow the steps you'll end up with log4j.properties in the lib directory that you can customize to your heart's content.

Outras dicas

The biggest performance hit is when preparing objects that you want to log (you know, when you do logger.info(" operating on " + myObject.toString + " bla bla bla" ) then doing myObject.toString() has the biggest cost). If you already have them than loggin to file is not a problem. And log4j is really well balanced and optimized, it uses buffers to write logs, so it do not make too frequent calls to file system.

Just create another appender, you will have a differentation from tomcat logs and your appilcation logs. How many logs do you have? A 1GB a day or more that you are afraid of performance loss? Don't assume anything before testing it. Just set-up, and do some kind of performance test.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top