Log4j vs Logback: concurrent writing to same log?

前端 未结 4 849
一个人的身影
一个人的身影 2021-01-04 01:50

I have several web applications running on the same tomcat.

I have two questions:

1- By searching, I understood that when multiple applications are present,

4条回答
  •  没有蜡笔的小新
    2021-01-04 02:01

    1. Yes. In general, your principle should be that you write a different log file for each application (web or not). The alternative, is that you leave it up to the server to decide on the file to write to. JBoss has ways to genericly log out, which will go to the same file. However, I still prefer to have a separate log for each application.
    2. As far as I know, both log4j and Logback aim to be minimal in the overhead they can cause the application, so there's unlikely to be one that's more favourable. If multiple JVMs is essential for you, I believe Logback is better at handling it, but using it outside this is not a bad idea.

提交回复
热议问题