You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Volkan Yazıcı <vo...@yazi.ci> on 2026/02/16 10:36:38 UTC

Re: Configuring log filenames in a multi-tenant, identical-WAR scenario

I'm pretty much a JEE/Jakarta illiterate, but have you checked the Integrating
with Jakarta EE <https://logging.apache.org/log4j/2.x/jakarta.html> page?

On Tue, Jan 27, 2026 at 11:01 AM Christopher Dodunski <
chris.webmail@christopher.nz> wrote:

> Dear Log4J2 community,
>
> I am currently exploring the possibility of deploying multiple (byte
> identical) WARs for servicing multiple tenants, but hosted by a single
> Tomcat installation.
>
> The WARs, although being identical (including web.xml), are to be named
> according to each tenant.  My main goal is having these web applications
> logging to different files.
>
>      tom.war >> /tom (Tomcat context) >> logs to tom.log
>
>      dick.war >> /dick >> logs to dick.log
>
>      harry.war >> /harry >> logs to harry.log
>
> I've created separate log4j2.xml configuration files for each and placed
> these in WEB-INF, as per below:
>
>      WEB-INF/log4j2-tom.xml
>
>      WEB-INF/log4j2-dick.xml
>
>      WEB-INF/log4j2-harry.xml
>
> I'd thought that the log4j-web package would allow Log4J to
> automatically select the correct XML based on Tomcat context, but this
> seems not to be the case.
>
> I'm eager to learn of a method that would allow log filenames to be set
> from outside the WAR, if possible.
>
> Thanking you in advance for any suggestions.
>
> Kind regards,
>
> Chris.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>