Are you including log4j-web in your war as well? On Wed, 5 Dec 2018 at 10:43, paginas <paralaspagin...@gmail.com> wrote:
> I added in my web.xml > <context-param> > <param-name>log4jConfiguration</param-name> > <param-value>file:///C:/ > <file:///C:/name/src/particularName/configuracion/entorno/conf-especial-name-log4j2.properties%3C/param-value%3E>name > <file:///C:/name/src/particularName/configuracion/entorno/conf-especial-name-log4j2.properties%3C/param-value%3E>/ > <file:///C:/name/src/particularName/configuracion/entorno/conf-especial-name-log4j2.properties%3C/param-value%3E>src > <file:///C:/name/src/particularName/configuracion/entorno/conf-especial-name-log4j2.properties%3C/param-value%3E>/particularName/ > <file:///C:/name/src/particularName/configuracion/entorno/conf-especial-name-log4j2.properties%3C/param-value%3E>configuracion > <file:///C:/name/src/particularName/configuracion/entorno/conf-especial-name-log4j2.properties%3C/param-value%3E>/ > <file:///C:/name/src/particularName/configuracion/entorno/conf-especial-name-log4j2.properties%3C/param-value%3E>entorno > <file:///C:/name/src/particularName/configuracion/entorno/conf-especial-name-log4j2.properties%3C/param-value%3E>/ > <file:///C:/name/src/particularName/configuracion/entorno/conf-especial-name-log4j2.properties%3C/param-value%3E>conf > <file:///C:/name/src/particularName/configuracion/entorno/conf-especial-name-log4j2.properties%3C/param-value%3E>-especial-name-log4j2.properties > <file:///C:/name/src/particularName/configuracion/entorno/conf-especial-name-log4j2.properties%3C/param-value%3E></ > <file:///C:/name/src/particularName/configuracion/entorno/conf-especial-name-log4j2.properties%3C/param-value%3E>param-value > <file:///C:/name/src/particularName/configuracion/entorno/conf-especial-name-log4j2.properties%3C/param-value%3E>> > <file:///C:/name/src/particularName/configuracion/entorno/conf-especial-name-log4j2.properties%3C/param-value%3E> > </context-param> > > And my application not works > > Could you give more support please? > > > El 5 dic 2018, a las 16:27, Ralph Goers <ralph.go...@dslextreme.com> > escribió: > > > > Even simpler. Just name the file "log4j2-name.xml” where “name” is the > name of the web application. > > > > Ralph > > > >> On Dec 5, 2018, at 8:23 AM, Ralph Goers <ralph.go...@dslextreme.com> > wrote: > >> > >> From what you are describing I would set log4jConfiguration in your web > application’s web.xml as a context parameter. See > http://logging.apache.org/log4j/2.x/manual/webapp.html < > http://logging.apache.org/log4j/2.x/manual/webapp.html>. > >> > >> Ralph > >> > >> > >>> On Dec 5, 2018, at 7:54 AM, paginas <paralaspagin...@gmail.com > <mailto:paralaspagin...@gmail.com>> wrote: > >>> > >>> Dear Log4j Team, > >>> > >>> First of all, thanks for your work. I am Leo, an Spanish web developer > that need some help. > >>> > >>> I am migrating one of our project from slf4j v. 1.7.21 to log4j > v.2.11.1 and I have this problem: > >>> > >>> -In my web project, we need to have the log4j.configurationFile with a > particular name: Particular_web_app_log4j2.properties (example name) > >>> > >>> We cannot set the default log4j2.properties, log4j2.xml, etc in our > repository. > >>> In slf4j we solved this situation with this code. (with this, all sl4j > configuration is loaded from our custom log4j.properties): > >>> > >>> URL log4jURL = Loader.getResource(Log4javaFileName); > >>> if (log4jURL == null) { > >>> throw new Exception(); > >>> } > >>> PropertyConfigurator.configure(log4jURL); > >>> > >>> In log4j2 this method is deprecated and I found some alternatives, but > any of them worked. > >>> Solution one: > >>> Set this property in my first line of code: > >>> System.setProperty("log4j.configurationFile",Log4java2FileName); > >>> It not works in my Websphere Application Server because > log4j2 try to charge before my first web app line of code. > >>> Solution two: > >>> using java -D option which sets a system > property on server start. > >>> It not works in my Websphere Application > Server because it is an application server with other applications and we > share the node, this change can affect to other apps. > >>> Solution three: > >>> Using an recharge of properties from custom XML properties: > >>> InputStream log4javaFile = > getClass().getClassLoader().getResourceAsStream(Log4java2FileName); > >>> ConfigurationSource configuration = > newConfigurationSource(log4javaFile); > >>> Configurator.initialize(null, configuration); > >>> It not works in my project because a regret to include this code in my > InitContext (first point of code), this change only affect in some class, > not in all context. (I have different servlets in my application and there > are not affected by this change) > >>> > >>> Question: > >>> Is there an easy alternative for adjusting the > properties file? (some like slf4j configuration) > >>> > >>> I would be very grateful if you could help me because I can not find a > solution and I would like to be able to use the new log4j2. > >>> Best regards! > >> > > > > -- Matt Sicker <boa...@gmail.com>