Can different EJBs deployed on the same container and works synchronously
write their application logs on the same .log file without any risk,
on the condition that they all use the same log4j.xml and the same FileAppender.
I confirmed it works out on my desktop,
but what if these EJBs are under high-loader operation?
Should I concern about file locking or delay issue?
Sincerely,
Yes, multiple EJBs in the same application server instance can write to the same appender. They are part of one JVM, and log4j is thread safe.
It’s true that under high load you will experience delays; but that’s what log levels are for. Log as few statements as possible on important levels, be verbose on debug levels.
Sharing the same file appender is possible (most of the time it appears to be working), but dangerous, especially with rolling policies set. You risk losing your logs this way, log4j has not been designed for this.