You would use Configurator.initialize(“MyContextName”, this.getClass().getClassLoader(), uri);
The classLoader value can be null. Ralph > On Jun 17, 2016, at 1:41 AM, Jochen Wiedmann <[email protected]> > wrote: > > Hi, > > I have an application (more precisely: a war file), which is deployed > identically on the same application server. (Think multi temancy), > Now, in Log4j 1, I handled that situation quite easily, like this: > > final String uri = tenantName + "/log4j.xml"; > final URL url = ClassLoader.getResource(uri); > if (uri == null) { > throw new IllegalStateException("Unable to locate logging > configuration: " + uri); > } > DOMConfigurator.configure(url); > > Or, in other words: For every tenant, I have a directory for > configuration files, including log4j.xml. > Simple, quick, and worked absolutely reliable. > > But, how do I get this to work with log4j2? > > Thanks, > > Jochen > > -- > The next time you hear: "Don't reinvent the wheel!" > > http://www.keystonedevelopment.co.uk/wp-content/uploads/2014/10/evolution-of-the-wheel-300x85.jpg > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
