Log4j vs Logback: concurrent writing to same log?

前端 未结 4 855
一个人的身影
一个人的身影 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:25

    There's one thing which must be clarified: There will be problems when different instances of Log4j are writing to the same file concurrently, whether running in the same JVM or not.

    When using servers (and different classloaders) it is possible to have a single server-wide instance or multiple instances of Log4j, depending on deployment and configuration.

    1. See above. Stdout can suffer the same mixed output problem, but not when rotating files.
    2. Logback's prudent mode would address concurrent writing by different instances (same JVM or not). If your configuration uses a server-wide Log4j instance there's no advantage for this aspect.

提交回复
热议问题