[jira] [Commented] (LOG4J2-747) Servlet Example of using different log4j2-{env:envValue}.xml
[ https://issues.apache.org/jira/browse/LOG4J2-747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14098478#comment-14098478 ] A B commented on LOG4J2-747: Remko / Matt, Also, this probably isn't the correct place for asking this, so let me know, if I should ask a separate question / bug report. I haven't been able to send the the mailing list for some time, evn though I have registered and used that address before, when I sent this question to that list multiple times, it did not show up there. Anyways, I did not find any information on how to initialise log4j2 ( preferably with similar file info as I tried here ) in an EJB3 application / project. Previously, I would use the @startup bean @PostConstruct along with {{PropertyConfigurator.configure(log4jProp);}} with log4j, but haven't found a way to do this in log4j2. Could you point me to any documentation that outlines it for EJB3, log4j2 combination? Thanks Servlet Example of using different log4j2-{env:envValue}.xml Key: LOG4J2-747 URL: https://issues.apache.org/jira/browse/LOG4J2-747 Project: Log4j 2 Issue Type: Bug Components: Configurators Affects Versions: 2.0-beta9 Environment: Websphere 8.5 Windows 7 Reporter: A B Attachments: LOG4J2-747_Jira.war, LOG4J2747_Jira_Sample3.ear, log4j2 location.jpg, log4j2-webapp-error.txt Based on my previous post / question on the log4j2 user list - Defining different log4j2.xml configurations based on environment - http://apache-logging.6191.n7.nabble.com/Defining-different-log4j2-xml-configurations-based-on-environment-tp40639p40662.html - I was attempting to create a Servlet Example of using different log4j2-\{env:envValue\}.xml. Based on the answers in this thread Defining different log4j2.xml configurations based on environment, from log4j user list I tried to test using a different config for different environments. This is what I have done. * I defined a Windows env variable {{websphere_environment}} and set its value to local * I specify the config location as log4j2-\{env:envValue\}.xml. My web.xml context-param looks like below - servlet version is 3.0. {code} context-param param-namelog4jConfigLocation/param-name param-value/WEB-INF/config/log4j2-${env:websphere_environment}.xml /param-value /context-param {code} My relevant servlet method looks like below {code} protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Logger logger = Logger.getLogger(ServletLog4j2Test.class.getName()); logger.fatal(Loaded:); // + /WEB-INF/config/log4j2-${env:websphere_environment}.xml } {code} I do not have the lo4j2-local.xml defined in the WEB-INF/config ( it is defined as log4j-local.xml, not log4j2-local.xml and was expecting to get an error but it seems that the servlet is using a default configuration, because when I run the servlet, I get {code} 07/24/14 07:14:07:564:FATAL:WebContainer : 0:: :com.test.log4j2.ServletLog4j2Test: Loaded: {code} How should my web-app and config files be set-up so that I can use different configs for different environments based on the environment? -- This message was sent by Atlassian JIRA (v6.2#6252) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-747) Servlet Example of using different log4j2-{env:envValue}.xml
[ https://issues.apache.org/jira/browse/LOG4J2-747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14098527#comment-14098527 ] Remko Popma commented on LOG4J2-747: The mailing list ignores messages with attachments. Perhaps that was the reason? Please try again, and if it doesn't work, it's beter to open another Jira for the new topic. Servlet Example of using different log4j2-{env:envValue}.xml Key: LOG4J2-747 URL: https://issues.apache.org/jira/browse/LOG4J2-747 Project: Log4j 2 Issue Type: Bug Components: Configurators Affects Versions: 2.0-beta9 Environment: Websphere 8.5 Windows 7 Reporter: A B Attachments: LOG4J2-747_Jira.war, LOG4J2747_Jira_Sample3.ear, log4j2 location.jpg, log4j2-webapp-error.txt Based on my previous post / question on the log4j2 user list - Defining different log4j2.xml configurations based on environment - http://apache-logging.6191.n7.nabble.com/Defining-different-log4j2-xml-configurations-based-on-environment-tp40639p40662.html - I was attempting to create a Servlet Example of using different log4j2-\{env:envValue\}.xml. Based on the answers in this thread Defining different log4j2.xml configurations based on environment, from log4j user list I tried to test using a different config for different environments. This is what I have done. * I defined a Windows env variable {{websphere_environment}} and set its value to local * I specify the config location as log4j2-\{env:envValue\}.xml. My web.xml context-param looks like below - servlet version is 3.0. {code} context-param param-namelog4jConfigLocation/param-name param-value/WEB-INF/config/log4j2-${env:websphere_environment}.xml /param-value /context-param {code} My relevant servlet method looks like below {code} protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Logger logger = Logger.getLogger(ServletLog4j2Test.class.getName()); logger.fatal(Loaded:); // + /WEB-INF/config/log4j2-${env:websphere_environment}.xml } {code} I do not have the lo4j2-local.xml defined in the WEB-INF/config ( it is defined as log4j-local.xml, not log4j2-local.xml and was expecting to get an error but it seems that the servlet is using a default configuration, because when I run the servlet, I get {code} 07/24/14 07:14:07:564:FATAL:WebContainer : 0:: :com.test.log4j2.ServletLog4j2Test: Loaded: {code} How should my web-app and config files be set-up so that I can use different configs for different environments based on the environment? -- This message was sent by Atlassian JIRA (v6.2#6252) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-747) Servlet Example of using different log4j2-{env:envValue}.xml
[ https://issues.apache.org/jira/browse/LOG4J2-747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14098541#comment-14098541 ] A B commented on LOG4J2-747: I sent one this morning and it still doesn't show up on the mailing list. It did not contain any attachments. I have used the same 'from' address before and it did show-up on the list previously ( WebServices Development Defining different log4j2.xml configurations based on environment Wed, 11 Sep, 11:21 ) with the same from address. So, that address is ( or was ) registered on the list, as far as I could tell. I will open another Jira for the topic. Thanks Servlet Example of using different log4j2-{env:envValue}.xml Key: LOG4J2-747 URL: https://issues.apache.org/jira/browse/LOG4J2-747 Project: Log4j 2 Issue Type: Bug Components: Configurators Affects Versions: 2.0-beta9 Environment: Websphere 8.5 Windows 7 Reporter: A B Attachments: LOG4J2-747_Jira.war, LOG4J2747_Jira_Sample3.ear, log4j2 location.jpg, log4j2-webapp-error.txt Based on my previous post / question on the log4j2 user list - Defining different log4j2.xml configurations based on environment - http://apache-logging.6191.n7.nabble.com/Defining-different-log4j2-xml-configurations-based-on-environment-tp40639p40662.html - I was attempting to create a Servlet Example of using different log4j2-\{env:envValue\}.xml. Based on the answers in this thread Defining different log4j2.xml configurations based on environment, from log4j user list I tried to test using a different config for different environments. This is what I have done. * I defined a Windows env variable {{websphere_environment}} and set its value to local * I specify the config location as log4j2-\{env:envValue\}.xml. My web.xml context-param looks like below - servlet version is 3.0. {code} context-param param-namelog4jConfigLocation/param-name param-value/WEB-INF/config/log4j2-${env:websphere_environment}.xml /param-value /context-param {code} My relevant servlet method looks like below {code} protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Logger logger = Logger.getLogger(ServletLog4j2Test.class.getName()); logger.fatal(Loaded:); // + /WEB-INF/config/log4j2-${env:websphere_environment}.xml } {code} I do not have the lo4j2-local.xml defined in the WEB-INF/config ( it is defined as log4j-local.xml, not log4j2-local.xml and was expecting to get an error but it seems that the servlet is using a default configuration, because when I run the servlet, I get {code} 07/24/14 07:14:07:564:FATAL:WebContainer : 0:: :com.test.log4j2.ServletLog4j2Test: Loaded: {code} How should my web-app and config files be set-up so that I can use different configs for different environments based on the environment? -- This message was sent by Atlassian JIRA (v6.2#6252) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-747) Servlet Example of using different log4j2-{env:envValue}.xml
[ https://issues.apache.org/jira/browse/LOG4J2-747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14096849#comment-14096849 ] A B commented on LOG4J2-747: Sure. I will go through the relevant documentation over the week-end and update here. Servlet Example of using different log4j2-{env:envValue}.xml Key: LOG4J2-747 URL: https://issues.apache.org/jira/browse/LOG4J2-747 Project: Log4j 2 Issue Type: Bug Components: Configurators Affects Versions: 2.0-beta9 Environment: Websphere 8.5 Windows 7 Reporter: A B Attachments: LOG4J2-747_Jira.war, LOG4J2747_Jira_Sample3.ear, log4j2 location.jpg, log4j2-webapp-error.txt Based on my previous post / question on the log4j2 user list - Defining different log4j2.xml configurations based on environment - http://apache-logging.6191.n7.nabble.com/Defining-different-log4j2-xml-configurations-based-on-environment-tp40639p40662.html - I was attempting to create a Servlet Example of using different log4j2-\{env:envValue\}.xml. Based on the answers in this thread Defining different log4j2.xml configurations based on environment, from log4j user list I tried to test using a different config for different environments. This is what I have done. * I defined a Windows env variable {{websphere_environment}} and set its value to local * I specify the config location as log4j2-\{env:envValue\}.xml. My web.xml context-param looks like below - servlet version is 3.0. {code} context-param param-namelog4jConfigLocation/param-name param-value/WEB-INF/config/log4j2-${env:websphere_environment}.xml /param-value /context-param {code} My relevant servlet method looks like below {code} protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Logger logger = Logger.getLogger(ServletLog4j2Test.class.getName()); logger.fatal(Loaded:); // + /WEB-INF/config/log4j2-${env:websphere_environment}.xml } {code} I do not have the lo4j2-local.xml defined in the WEB-INF/config ( it is defined as log4j-local.xml, not log4j2-local.xml and was expecting to get an error but it seems that the servlet is using a default configuration, because when I run the servlet, I get {code} 07/24/14 07:14:07:564:FATAL:WebContainer : 0:: :com.test.log4j2.ServletLog4j2Test: Loaded: {code} How should my web-app and config files be set-up so that I can use different configs for different environments based on the environment? -- This message was sent by Atlassian JIRA (v6.2#6252) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-747) Servlet Example of using different log4j2-{env:envValue}.xml
[ https://issues.apache.org/jira/browse/LOG4J2-747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14095360#comment-14095360 ] A B commented on LOG4J2-747: I have good news! I first tried using the ${sys:variable} as Remko suggested. That worked. So I started thinking for reasons why env: wouldn't work and I finally got ${env:variable} to work as wel.. What had happend was that after creating the variable, I knew I had to restart the process ( not necessarily re-boot the machine in Windows 7 ). So, I was doing a restart on my workspace. After a few attempts, I tried to display the environment variables. My variable did not show up. So, I exited the workspace and opened it again. This time my variable also showed up and the ${env:variable} for my log4j also worked. I guess, there is a difference in restart workspace from Eclipse vs. close and open it. Thanks again Servlet Example of using different log4j2-{env:envValue}.xml Key: LOG4J2-747 URL: https://issues.apache.org/jira/browse/LOG4J2-747 Project: Log4j 2 Issue Type: Bug Components: Configurators Affects Versions: 2.0-beta9 Environment: Websphere 8.5 Windows 7 Reporter: A B Attachments: LOG4J2-747_Jira.war, LOG4J2747_Jira_Sample3.ear, log4j2 location.jpg, log4j2-webapp-error.txt Based on my previous post / question on the log4j2 user list - Defining different log4j2.xml configurations based on environment - http://apache-logging.6191.n7.nabble.com/Defining-different-log4j2-xml-configurations-based-on-environment-tp40639p40662.html - I was attempting to create a Servlet Example of using different log4j2-\{env:envValue\}.xml. Based on the answers in this thread Defining different log4j2.xml configurations based on environment, from log4j user list I tried to test using a different config for different environments. This is what I have done. * I defined a Windows env variable {{websphere_environment}} and set its value to local * I specify the config location as log4j2-\{env:envValue\}.xml. My web.xml context-param looks like below - servlet version is 3.0. {code} context-param param-namelog4jConfigLocation/param-name param-value/WEB-INF/config/log4j2-${env:websphere_environment}.xml /param-value /context-param {code} My relevant servlet method looks like below {code} protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Logger logger = Logger.getLogger(ServletLog4j2Test.class.getName()); logger.fatal(Loaded:); // + /WEB-INF/config/log4j2-${env:websphere_environment}.xml } {code} I do not have the lo4j2-local.xml defined in the WEB-INF/config ( it is defined as log4j-local.xml, not log4j2-local.xml and was expecting to get an error but it seems that the servlet is using a default configuration, because when I run the servlet, I get {code} 07/24/14 07:14:07:564:FATAL:WebContainer : 0:: :com.test.log4j2.ServletLog4j2Test: Loaded: {code} How should my web-app and config files be set-up so that I can use different configs for different environments based on the environment? -- This message was sent by Atlassian JIRA (v6.2#6252) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-747) Servlet Example of using different log4j2-{env:envValue}.xml
[ https://issues.apache.org/jira/browse/LOG4J2-747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14095369#comment-14095369 ] Remko Popma commented on LOG4J2-747: I'm very glad to hear that! Before we close this issue, can you help us improve log4j by pointing out any places where the documentation can be improved? Anything that would have helped you resolve this issue sooner will be useful I think. If there are multiple pages please mention the page and section you want to improve. Text we can copy paste into the documentation would be ideal. Much appreciated! Servlet Example of using different log4j2-{env:envValue}.xml Key: LOG4J2-747 URL: https://issues.apache.org/jira/browse/LOG4J2-747 Project: Log4j 2 Issue Type: Bug Components: Configurators Affects Versions: 2.0-beta9 Environment: Websphere 8.5 Windows 7 Reporter: A B Attachments: LOG4J2-747_Jira.war, LOG4J2747_Jira_Sample3.ear, log4j2 location.jpg, log4j2-webapp-error.txt Based on my previous post / question on the log4j2 user list - Defining different log4j2.xml configurations based on environment - http://apache-logging.6191.n7.nabble.com/Defining-different-log4j2-xml-configurations-based-on-environment-tp40639p40662.html - I was attempting to create a Servlet Example of using different log4j2-\{env:envValue\}.xml. Based on the answers in this thread Defining different log4j2.xml configurations based on environment, from log4j user list I tried to test using a different config for different environments. This is what I have done. * I defined a Windows env variable {{websphere_environment}} and set its value to local * I specify the config location as log4j2-\{env:envValue\}.xml. My web.xml context-param looks like below - servlet version is 3.0. {code} context-param param-namelog4jConfigLocation/param-name param-value/WEB-INF/config/log4j2-${env:websphere_environment}.xml /param-value /context-param {code} My relevant servlet method looks like below {code} protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Logger logger = Logger.getLogger(ServletLog4j2Test.class.getName()); logger.fatal(Loaded:); // + /WEB-INF/config/log4j2-${env:websphere_environment}.xml } {code} I do not have the lo4j2-local.xml defined in the WEB-INF/config ( it is defined as log4j-local.xml, not log4j2-local.xml and was expecting to get an error but it seems that the servlet is using a default configuration, because when I run the servlet, I get {code} 07/24/14 07:14:07:564:FATAL:WebContainer : 0:: :com.test.log4j2.ServletLog4j2Test: Loaded: {code} How should my web-app and config files be set-up so that I can use different configs for different environments based on the environment? -- This message was sent by Atlassian JIRA (v6.2#6252) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-747) Servlet Example of using different log4j2-{env:envValue}.xml
[ https://issues.apache.org/jira/browse/LOG4J2-747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14094104#comment-14094104 ] Remko Popma commented on LOG4J2-747: In the attached WAR file, the web.xml uses {{param-namelog4jConfigLocation/param-name}}. This is wrong and should be {{log4jConfiguration}}, not log4jConfigLocation. (Your most recent comment uses the correct key, so you may have already fixed this.) I looked at the [source code|http://logging.apache.org/log4j/2.x/log4j-web/xref/org/apache/logging/log4j/web/Log4jWebInitializerImpl.html#83] and it is using a StrSubstitutor which should take care of looking up environment variables. However, it is probably better to take things one step at a time and first make sure log4j can find a configuration without environment variables first, then try adding environment variables. Looking at the source for [resolving the location|http://logging.apache.org/log4j/2.x/log4j-web/xref/org/apache/logging/log4j/web/Log4jWebInitializerImpl.html#142], it looks like a path like {{/WEB-INF/config/log4j2.xml}} should work (assuming that a file named log4j2.xml actually exists in the /WEB-INF/config/ folder in the web app. You said you had trouble getting the param-value/WEB-INF/config/log4j2.xml/param-value to work. (I don't think you need additional context parameters.) We should fix this first. Things to double-check: * param-name is {{log4jConfiguration}}, not log4jConfigLocation * The /WEB-INF/config/log4j2.xml file really exists (in the attached WAR this file does not exist, only log4j-*.xml files. Please double-check the spelling). * You have log4j-web-2.0.1.jar in the classpath * Are you seeing any error messages? (If so, what are they?) Servlet Example of using different log4j2-{env:envValue}.xml Key: LOG4J2-747 URL: https://issues.apache.org/jira/browse/LOG4J2-747 Project: Log4j 2 Issue Type: Bug Components: Configurators Affects Versions: 2.0-beta9 Environment: Websphere 8.5 Windows 7 Reporter: A B Attachments: LOG4J2-747_Jira.war, LOG4J2747_Jira_Sample3.ear Based on my previous post / question on the log4j2 user list - Defining different log4j2.xml configurations based on environment - http://apache-logging.6191.n7.nabble.com/Defining-different-log4j2-xml-configurations-based-on-environment-tp40639p40662.html - I was attempting to create a Servlet Example of using different log4j2-\{env:envValue\}.xml. Based on the answers in this thread Defining different log4j2.xml configurations based on environment, from log4j user list I tried to test using a different config for different environments. This is what I have done. * I defined a Windows env variable {{websphere_environment}} and set its value to local * I specify the config location as log4j2-\{env:envValue\}.xml. My web.xml context-param looks like below - servlet version is 3.0. {code} context-param param-namelog4jConfigLocation/param-name param-value/WEB-INF/config/log4j2-${env:websphere_environment}.xml /param-value /context-param {code} My relevant servlet method looks like below {code} protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Logger logger = Logger.getLogger(ServletLog4j2Test.class.getName()); logger.fatal(Loaded:); // + /WEB-INF/config/log4j2-${env:websphere_environment}.xml } {code} I do not have the lo4j2-local.xml defined in the WEB-INF/config ( it is defined as log4j-local.xml, not log4j2-local.xml and was expecting to get an error but it seems that the servlet is using a default configuration, because when I run the servlet, I get {code} 07/24/14 07:14:07:564:FATAL:WebContainer : 0:: :com.test.log4j2.ServletLog4j2Test: Loaded: {code} How should my web-app and config files be set-up so that I can use different configs for different environments based on the environment? -- This message was sent by Atlassian JIRA (v6.2#6252) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-747) Servlet Example of using different log4j2-{env:envValue}.xml
[ https://issues.apache.org/jira/browse/LOG4J2-747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14094123#comment-14094123 ] A B commented on LOG4J2-747: Sorry, about the parameter. I have changed it to corect one. Should I remove the original attachments? The new web.xml looks like this [code] context-param param-namelog4jConfiguration/param-name param-value/WEB-INF/config/log4j2.xml/param-value /context-param [code] - Yes, the /WEB-INF/config/log4j2.xml exists - When I add log4j-web-2.0.1.jar, I get an error I will try to attach the image of the web-inf and error text file Servlet Example of using different log4j2-{env:envValue}.xml Key: LOG4J2-747 URL: https://issues.apache.org/jira/browse/LOG4J2-747 Project: Log4j 2 Issue Type: Bug Components: Configurators Affects Versions: 2.0-beta9 Environment: Websphere 8.5 Windows 7 Reporter: A B Attachments: LOG4J2-747_Jira.war, LOG4J2747_Jira_Sample3.ear Based on my previous post / question on the log4j2 user list - Defining different log4j2.xml configurations based on environment - http://apache-logging.6191.n7.nabble.com/Defining-different-log4j2-xml-configurations-based-on-environment-tp40639p40662.html - I was attempting to create a Servlet Example of using different log4j2-\{env:envValue\}.xml. Based on the answers in this thread Defining different log4j2.xml configurations based on environment, from log4j user list I tried to test using a different config for different environments. This is what I have done. * I defined a Windows env variable {{websphere_environment}} and set its value to local * I specify the config location as log4j2-\{env:envValue\}.xml. My web.xml context-param looks like below - servlet version is 3.0. {code} context-param param-namelog4jConfigLocation/param-name param-value/WEB-INF/config/log4j2-${env:websphere_environment}.xml /param-value /context-param {code} My relevant servlet method looks like below {code} protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Logger logger = Logger.getLogger(ServletLog4j2Test.class.getName()); logger.fatal(Loaded:); // + /WEB-INF/config/log4j2-${env:websphere_environment}.xml } {code} I do not have the lo4j2-local.xml defined in the WEB-INF/config ( it is defined as log4j-local.xml, not log4j2-local.xml and was expecting to get an error but it seems that the servlet is using a default configuration, because when I run the servlet, I get {code} 07/24/14 07:14:07:564:FATAL:WebContainer : 0:: :com.test.log4j2.ServletLog4j2Test: Loaded: {code} How should my web-app and config files be set-up so that I can use different configs for different environments based on the environment? -- This message was sent by Atlassian JIRA (v6.2#6252) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-747) Servlet Example of using different log4j2-{env:envValue}.xml
[ https://issues.apache.org/jira/browse/LOG4J2-747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14094132#comment-14094132 ] Remko Popma commented on LOG4J2-747: Ok thanks, that screenshot is helpful. * You don't need the -sources.jar files. * You do need log4j-web-2.0.1.jar : the lookup logic for the log4jConfiguration context parameter lives in that jar... * What is the exact error when you add log4j-web-2.0.1.jar to WEB-INF/lib? Servlet Example of using different log4j2-{env:envValue}.xml Key: LOG4J2-747 URL: https://issues.apache.org/jira/browse/LOG4J2-747 Project: Log4j 2 Issue Type: Bug Components: Configurators Affects Versions: 2.0-beta9 Environment: Websphere 8.5 Windows 7 Reporter: A B Attachments: LOG4J2-747_Jira.war, LOG4J2747_Jira_Sample3.ear, log4j2 location.jpg, log4j2-webapp-error.txt Based on my previous post / question on the log4j2 user list - Defining different log4j2.xml configurations based on environment - http://apache-logging.6191.n7.nabble.com/Defining-different-log4j2-xml-configurations-based-on-environment-tp40639p40662.html - I was attempting to create a Servlet Example of using different log4j2-\{env:envValue\}.xml. Based on the answers in this thread Defining different log4j2.xml configurations based on environment, from log4j user list I tried to test using a different config for different environments. This is what I have done. * I defined a Windows env variable {{websphere_environment}} and set its value to local * I specify the config location as log4j2-\{env:envValue\}.xml. My web.xml context-param looks like below - servlet version is 3.0. {code} context-param param-namelog4jConfigLocation/param-name param-value/WEB-INF/config/log4j2-${env:websphere_environment}.xml /param-value /context-param {code} My relevant servlet method looks like below {code} protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Logger logger = Logger.getLogger(ServletLog4j2Test.class.getName()); logger.fatal(Loaded:); // + /WEB-INF/config/log4j2-${env:websphere_environment}.xml } {code} I do not have the lo4j2-local.xml defined in the WEB-INF/config ( it is defined as log4j-local.xml, not log4j2-local.xml and was expecting to get an error but it seems that the servlet is using a default configuration, because when I run the servlet, I get {code} 07/24/14 07:14:07:564:FATAL:WebContainer : 0:: :com.test.log4j2.ServletLog4j2Test: Loaded: {code} How should my web-app and config files be set-up so that I can use different configs for different environments based on the environment? -- This message was sent by Atlassian JIRA (v6.2#6252) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-747) Servlet Example of using different log4j2-{env:envValue}.xml
[ https://issues.apache.org/jira/browse/LOG4J2-747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14094143#comment-14094143 ] Remko Popma commented on LOG4J2-747: Hm... the error text says WebFragMergerException: two fragments have the name [log4j] I don't know what a fragment is in this context. Could it be that the log4j2 jars exist twice? Are they also installed in the web container's shared library folder, for example? Servlet Example of using different log4j2-{env:envValue}.xml Key: LOG4J2-747 URL: https://issues.apache.org/jira/browse/LOG4J2-747 Project: Log4j 2 Issue Type: Bug Components: Configurators Affects Versions: 2.0-beta9 Environment: Websphere 8.5 Windows 7 Reporter: A B Attachments: LOG4J2-747_Jira.war, LOG4J2747_Jira_Sample3.ear, log4j2 location.jpg, log4j2-webapp-error.txt Based on my previous post / question on the log4j2 user list - Defining different log4j2.xml configurations based on environment - http://apache-logging.6191.n7.nabble.com/Defining-different-log4j2-xml-configurations-based-on-environment-tp40639p40662.html - I was attempting to create a Servlet Example of using different log4j2-\{env:envValue\}.xml. Based on the answers in this thread Defining different log4j2.xml configurations based on environment, from log4j user list I tried to test using a different config for different environments. This is what I have done. * I defined a Windows env variable {{websphere_environment}} and set its value to local * I specify the config location as log4j2-\{env:envValue\}.xml. My web.xml context-param looks like below - servlet version is 3.0. {code} context-param param-namelog4jConfigLocation/param-name param-value/WEB-INF/config/log4j2-${env:websphere_environment}.xml /param-value /context-param {code} My relevant servlet method looks like below {code} protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Logger logger = Logger.getLogger(ServletLog4j2Test.class.getName()); logger.fatal(Loaded:); // + /WEB-INF/config/log4j2-${env:websphere_environment}.xml } {code} I do not have the lo4j2-local.xml defined in the WEB-INF/config ( it is defined as log4j-local.xml, not log4j2-local.xml and was expecting to get an error but it seems that the servlet is using a default configuration, because when I run the servlet, I get {code} 07/24/14 07:14:07:564:FATAL:WebContainer : 0:: :com.test.log4j2.ServletLog4j2Test: Loaded: {code} How should my web-app and config files be set-up so that I can use different configs for different environments based on the environment? -- This message was sent by Atlassian JIRA (v6.2#6252) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-747) Servlet Example of using different log4j2-{env:envValue}.xml
[ https://issues.apache.org/jira/browse/LOG4J2-747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14094176#comment-14094176 ] Remko Popma commented on LOG4J2-747: log4j-web-2.0.1.jar contains a /META-INF/web-fragment.xml that looks like this: {code} web-fragment xmlns=http://java.sun.com/xml/ns/javaee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd; version=3.0 metadata-complete=true !-- The Log4j web fragment must be loaded before all other fragments. The configuration below should make this happen automatically. If you experience problems, try specifying an absolute-ordering in your web.xml deployment descriptor. -- namelog4j/name distributable / ordering before others / /before /ordering /web-fragment {code} Note the namelog4j/name element. Since the error message says two fragments have the name [log4j], I suspect there is another jar in the classpath with this fragment. Older versions of log4j2 used to have the web-related logic (and this fragment) in the log4j-core jar. Could it be there is an older version (pre 2.0) of log4j-core in the classpath? Servlet Example of using different log4j2-{env:envValue}.xml Key: LOG4J2-747 URL: https://issues.apache.org/jira/browse/LOG4J2-747 Project: Log4j 2 Issue Type: Bug Components: Configurators Affects Versions: 2.0-beta9 Environment: Websphere 8.5 Windows 7 Reporter: A B Attachments: LOG4J2-747_Jira.war, LOG4J2747_Jira_Sample3.ear, log4j2 location.jpg, log4j2-webapp-error.txt Based on my previous post / question on the log4j2 user list - Defining different log4j2.xml configurations based on environment - http://apache-logging.6191.n7.nabble.com/Defining-different-log4j2-xml-configurations-based-on-environment-tp40639p40662.html - I was attempting to create a Servlet Example of using different log4j2-\{env:envValue\}.xml. Based on the answers in this thread Defining different log4j2.xml configurations based on environment, from log4j user list I tried to test using a different config for different environments. This is what I have done. * I defined a Windows env variable {{websphere_environment}} and set its value to local * I specify the config location as log4j2-\{env:envValue\}.xml. My web.xml context-param looks like below - servlet version is 3.0. {code} context-param param-namelog4jConfigLocation/param-name param-value/WEB-INF/config/log4j2-${env:websphere_environment}.xml /param-value /context-param {code} My relevant servlet method looks like below {code} protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Logger logger = Logger.getLogger(ServletLog4j2Test.class.getName()); logger.fatal(Loaded:); // + /WEB-INF/config/log4j2-${env:websphere_environment}.xml } {code} I do not have the lo4j2-local.xml defined in the WEB-INF/config ( it is defined as log4j-local.xml, not log4j2-local.xml and was expecting to get an error but it seems that the servlet is using a default configuration, because when I run the servlet, I get {code} 07/24/14 07:14:07:564:FATAL:WebContainer : 0:: :com.test.log4j2.ServletLog4j2Test: Loaded: {code} How should my web-app and config files be set-up so that I can use different configs for different environments based on the environment? -- This message was sent by Atlassian JIRA (v6.2#6252) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-747) Servlet Example of using different log4j2-{env:envValue}.xml
[ https://issues.apache.org/jira/browse/LOG4J2-747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14094372#comment-14094372 ] A B commented on LOG4J2-747: If I don't add the log4j-web jar file, then it does goes back to its default configuration and prints ERROR and FATAL messages, but not other ones. I checked for the classpath - this is a minimalist project with just the jars I had shown you in the screen-shot, no other jars anywhere in the classpath. I knew I didn't need the sources, Just have a habit of adding sources, if I want to debug. I removed the web sources jar from the project and now it seems to work. So, it appears that when I add the sources for log4j-web, the web-fragment from that source is probably scanned and considered a different web-fragment with teh same name and that generates an error. This maybe something you may want to look at - or outline a way where people should add the sources if they want to debug... I also tried by changing the name of the log4j config file - changing it from log4j2.xml to log4j2_env.xml which exists and log4j2_env2.xml which doesn't exist ( env is part of the name, not environment variable ) So, the observation is - if I define the log4jConfiguration and point it to an existing config file, that is used. If log4jConfiguration is pointing to non-existent file, the default is used. Other observation is, using the sources jar along with the web jar ( or would be the case for any jar containing the web-fragment, it would happen ) will give duplicate web fragment error I will now try using the actual environment variable sometime today and report the outcome here. Thanks for the suggestions and help you are providing Servlet Example of using different log4j2-{env:envValue}.xml Key: LOG4J2-747 URL: https://issues.apache.org/jira/browse/LOG4J2-747 Project: Log4j 2 Issue Type: Bug Components: Configurators Affects Versions: 2.0-beta9 Environment: Websphere 8.5 Windows 7 Reporter: A B Attachments: LOG4J2-747_Jira.war, LOG4J2747_Jira_Sample3.ear, log4j2 location.jpg, log4j2-webapp-error.txt Based on my previous post / question on the log4j2 user list - Defining different log4j2.xml configurations based on environment - http://apache-logging.6191.n7.nabble.com/Defining-different-log4j2-xml-configurations-based-on-environment-tp40639p40662.html - I was attempting to create a Servlet Example of using different log4j2-\{env:envValue\}.xml. Based on the answers in this thread Defining different log4j2.xml configurations based on environment, from log4j user list I tried to test using a different config for different environments. This is what I have done. * I defined a Windows env variable {{websphere_environment}} and set its value to local * I specify the config location as log4j2-\{env:envValue\}.xml. My web.xml context-param looks like below - servlet version is 3.0. {code} context-param param-namelog4jConfigLocation/param-name param-value/WEB-INF/config/log4j2-${env:websphere_environment}.xml /param-value /context-param {code} My relevant servlet method looks like below {code} protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Logger logger = Logger.getLogger(ServletLog4j2Test.class.getName()); logger.fatal(Loaded:); // + /WEB-INF/config/log4j2-${env:websphere_environment}.xml } {code} I do not have the lo4j2-local.xml defined in the WEB-INF/config ( it is defined as log4j-local.xml, not log4j2-local.xml and was expecting to get an error but it seems that the servlet is using a default configuration, because when I run the servlet, I get {code} 07/24/14 07:14:07:564:FATAL:WebContainer : 0:: :com.test.log4j2.ServletLog4j2Test: Loaded: {code} How should my web-app and config files be set-up so that I can use different configs for different environments based on the environment? -- This message was sent by Atlassian JIRA (v6.2#6252) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-747) Servlet Example of using different log4j2-{env:envValue}.xml
[ https://issues.apache.org/jira/browse/LOG4J2-747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14094599#comment-14094599 ] A B commented on LOG4J2-747: I tried to test with the environment variable {code} context-param param-namelog4jConfiguration/param-name param-value/WEB-INF/config2/log4j2_${env:websphere_environment}.xml/param-value /context-param {code} and I get the error {{[8/12/14 15:57:55:330 EDT] 0041 webappI com.ibm.ws.webcontainer.webapp.WebApp log SRVE0296E: [Log4j2Test1#Log4j2Test1War1.war][/Log4j2Test1War1][Servlet.LOG]:.Unable to convert configuration location [/WEB-INF/config2/log4j2_${env:websphere_environment}.xml] to a URI!:.java.net.URISyntaxException: Illegal character in path at index 25: /WEB-INF/config2/log4j2_${env:websphere_environment}.xml }} So, it seems I couldn't use the environment variable. Can you please take a look at that? Servlet Example of using different log4j2-{env:envValue}.xml Key: LOG4J2-747 URL: https://issues.apache.org/jira/browse/LOG4J2-747 Project: Log4j 2 Issue Type: Bug Components: Configurators Affects Versions: 2.0-beta9 Environment: Websphere 8.5 Windows 7 Reporter: A B Attachments: LOG4J2-747_Jira.war, LOG4J2747_Jira_Sample3.ear, log4j2 location.jpg, log4j2-webapp-error.txt Based on my previous post / question on the log4j2 user list - Defining different log4j2.xml configurations based on environment - http://apache-logging.6191.n7.nabble.com/Defining-different-log4j2-xml-configurations-based-on-environment-tp40639p40662.html - I was attempting to create a Servlet Example of using different log4j2-\{env:envValue\}.xml. Based on the answers in this thread Defining different log4j2.xml configurations based on environment, from log4j user list I tried to test using a different config for different environments. This is what I have done. * I defined a Windows env variable {{websphere_environment}} and set its value to local * I specify the config location as log4j2-\{env:envValue\}.xml. My web.xml context-param looks like below - servlet version is 3.0. {code} context-param param-namelog4jConfigLocation/param-name param-value/WEB-INF/config/log4j2-${env:websphere_environment}.xml /param-value /context-param {code} My relevant servlet method looks like below {code} protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Logger logger = Logger.getLogger(ServletLog4j2Test.class.getName()); logger.fatal(Loaded:); // + /WEB-INF/config/log4j2-${env:websphere_environment}.xml } {code} I do not have the lo4j2-local.xml defined in the WEB-INF/config ( it is defined as log4j-local.xml, not log4j2-local.xml and was expecting to get an error but it seems that the servlet is using a default configuration, because when I run the servlet, I get {code} 07/24/14 07:14:07:564:FATAL:WebContainer : 0:: :com.test.log4j2.ServletLog4j2Test: Loaded: {code} How should my web-app and config files be set-up so that I can use different configs for different environments based on the environment? -- This message was sent by Atlassian JIRA (v6.2#6252) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-747) Servlet Example of using different log4j2-{env:envValue}.xml
[ https://issues.apache.org/jira/browse/LOG4J2-747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14094875#comment-14094875 ] Remko Popma commented on LOG4J2-747: Progress! Very good. I think there are two approaches we can take going forward: # Keep trying to make the environment $\{env:somevar\} or system property $\{sys:somevar\} work in the path to the configuration. Next step here would be trying to URL-encode the '$' and perhaps also the '\{' and '\}' characters. # Use a different approach. Have one single log4j2.xml file, and point to that from log4jConfiguration. We know this works now. Then, from inside that log4j2.xml config file, use XInclude to point to the actual loggers and appenders you want to use. Part of the XInclude path would be an environment $\{env:somevar\} or system property $\{sys:somevar\} so you still have different configurations for different scenarios. See LOG4J2-341 for an example, I don't think XInclude is documented on the log4j2 web site anywhere. Again, if you decide to use the XInclude approach, do this step by step, so first without environment variables to make sure it works, then introduce the variables. Servlet Example of using different log4j2-{env:envValue}.xml Key: LOG4J2-747 URL: https://issues.apache.org/jira/browse/LOG4J2-747 Project: Log4j 2 Issue Type: Bug Components: Configurators Affects Versions: 2.0-beta9 Environment: Websphere 8.5 Windows 7 Reporter: A B Attachments: LOG4J2-747_Jira.war, LOG4J2747_Jira_Sample3.ear, log4j2 location.jpg, log4j2-webapp-error.txt Based on my previous post / question on the log4j2 user list - Defining different log4j2.xml configurations based on environment - http://apache-logging.6191.n7.nabble.com/Defining-different-log4j2-xml-configurations-based-on-environment-tp40639p40662.html - I was attempting to create a Servlet Example of using different log4j2-\{env:envValue\}.xml. Based on the answers in this thread Defining different log4j2.xml configurations based on environment, from log4j user list I tried to test using a different config for different environments. This is what I have done. * I defined a Windows env variable {{websphere_environment}} and set its value to local * I specify the config location as log4j2-\{env:envValue\}.xml. My web.xml context-param looks like below - servlet version is 3.0. {code} context-param param-namelog4jConfigLocation/param-name param-value/WEB-INF/config/log4j2-${env:websphere_environment}.xml /param-value /context-param {code} My relevant servlet method looks like below {code} protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Logger logger = Logger.getLogger(ServletLog4j2Test.class.getName()); logger.fatal(Loaded:); // + /WEB-INF/config/log4j2-${env:websphere_environment}.xml } {code} I do not have the lo4j2-local.xml defined in the WEB-INF/config ( it is defined as log4j-local.xml, not log4j2-local.xml and was expecting to get an error but it seems that the servlet is using a default configuration, because when I run the servlet, I get {code} 07/24/14 07:14:07:564:FATAL:WebContainer : 0:: :com.test.log4j2.ServletLog4j2Test: Loaded: {code} How should my web-app and config files be set-up so that I can use different configs for different environments based on the environment? -- This message was sent by Atlassian JIRA (v6.2#6252) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-747) Servlet Example of using different log4j2-{env:envValue}.xml
[ https://issues.apache.org/jira/browse/LOG4J2-747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14094934#comment-14094934 ] Matt Sicker commented on LOG4J2-747: Pretty sure you have to put log4j2.xml inside {{/WEB-INF/classes/log4j2.xml}} or similar. The WEB-INF directory is special like that in that it's supposed to be somewhat hidden. Servlet Example of using different log4j2-{env:envValue}.xml Key: LOG4J2-747 URL: https://issues.apache.org/jira/browse/LOG4J2-747 Project: Log4j 2 Issue Type: Bug Components: Configurators Affects Versions: 2.0-beta9 Environment: Websphere 8.5 Windows 7 Reporter: A B Attachments: LOG4J2-747_Jira.war, LOG4J2747_Jira_Sample3.ear, log4j2 location.jpg, log4j2-webapp-error.txt Based on my previous post / question on the log4j2 user list - Defining different log4j2.xml configurations based on environment - http://apache-logging.6191.n7.nabble.com/Defining-different-log4j2-xml-configurations-based-on-environment-tp40639p40662.html - I was attempting to create a Servlet Example of using different log4j2-\{env:envValue\}.xml. Based on the answers in this thread Defining different log4j2.xml configurations based on environment, from log4j user list I tried to test using a different config for different environments. This is what I have done. * I defined a Windows env variable {{websphere_environment}} and set its value to local * I specify the config location as log4j2-\{env:envValue\}.xml. My web.xml context-param looks like below - servlet version is 3.0. {code} context-param param-namelog4jConfigLocation/param-name param-value/WEB-INF/config/log4j2-${env:websphere_environment}.xml /param-value /context-param {code} My relevant servlet method looks like below {code} protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Logger logger = Logger.getLogger(ServletLog4j2Test.class.getName()); logger.fatal(Loaded:); // + /WEB-INF/config/log4j2-${env:websphere_environment}.xml } {code} I do not have the lo4j2-local.xml defined in the WEB-INF/config ( it is defined as log4j-local.xml, not log4j2-local.xml and was expecting to get an error but it seems that the servlet is using a default configuration, because when I run the servlet, I get {code} 07/24/14 07:14:07:564:FATAL:WebContainer : 0:: :com.test.log4j2.ServletLog4j2Test: Loaded: {code} How should my web-app and config files be set-up so that I can use different configs for different environments based on the environment? -- This message was sent by Atlassian JIRA (v6.2#6252) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-747) Servlet Example of using different log4j2-{env:envValue}.xml
[ https://issues.apache.org/jira/browse/LOG4J2-747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14094946#comment-14094946 ] A B commented on LOG4J2-747: @Matt - I have moved beyond ability to use {{WEB-INF/config/log4j_abc.xml}}. I got that working @Remko - I will try the XInclude way tomorrow morning, but if it is possible, I would like to get the environment $\{env:somevar\} or system property $\{sys:somevar\} work in the path to the configuration. Reason being that it seems to be more obvious for someone else looking at the project, when it is in web.xml Thanks Servlet Example of using different log4j2-{env:envValue}.xml Key: LOG4J2-747 URL: https://issues.apache.org/jira/browse/LOG4J2-747 Project: Log4j 2 Issue Type: Bug Components: Configurators Affects Versions: 2.0-beta9 Environment: Websphere 8.5 Windows 7 Reporter: A B Attachments: LOG4J2-747_Jira.war, LOG4J2747_Jira_Sample3.ear, log4j2 location.jpg, log4j2-webapp-error.txt Based on my previous post / question on the log4j2 user list - Defining different log4j2.xml configurations based on environment - http://apache-logging.6191.n7.nabble.com/Defining-different-log4j2-xml-configurations-based-on-environment-tp40639p40662.html - I was attempting to create a Servlet Example of using different log4j2-\{env:envValue\}.xml. Based on the answers in this thread Defining different log4j2.xml configurations based on environment, from log4j user list I tried to test using a different config for different environments. This is what I have done. * I defined a Windows env variable {{websphere_environment}} and set its value to local * I specify the config location as log4j2-\{env:envValue\}.xml. My web.xml context-param looks like below - servlet version is 3.0. {code} context-param param-namelog4jConfigLocation/param-name param-value/WEB-INF/config/log4j2-${env:websphere_environment}.xml /param-value /context-param {code} My relevant servlet method looks like below {code} protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Logger logger = Logger.getLogger(ServletLog4j2Test.class.getName()); logger.fatal(Loaded:); // + /WEB-INF/config/log4j2-${env:websphere_environment}.xml } {code} I do not have the lo4j2-local.xml defined in the WEB-INF/config ( it is defined as log4j-local.xml, not log4j2-local.xml and was expecting to get an error but it seems that the servlet is using a default configuration, because when I run the servlet, I get {code} 07/24/14 07:14:07:564:FATAL:WebContainer : 0:: :com.test.log4j2.ServletLog4j2Test: Loaded: {code} How should my web-app and config files be set-up so that I can use different configs for different environments based on the environment? -- This message was sent by Atlassian JIRA (v6.2#6252) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-747) Servlet Example of using different log4j2-{env:envValue}.xml
[ https://issues.apache.org/jira/browse/LOG4J2-747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14094960#comment-14094960 ] Matt Sicker commented on LOG4J2-747: One method you can use is by setting {{log4jContextName}} (or the {{ServletContext}} itself), you can use a file named {{/WEB-INF/log4j2-foo.xml}} where foo is the name. Really, it's strange that you're even getting the error you're getting. The {{$\{env:FOO\}}} bit should be replaced by the environment variable {{FOO}} before it ever gets parsed as a URI. Edit: darn this JIRA syntax. Servlet Example of using different log4j2-{env:envValue}.xml Key: LOG4J2-747 URL: https://issues.apache.org/jira/browse/LOG4J2-747 Project: Log4j 2 Issue Type: Bug Components: Configurators Affects Versions: 2.0-beta9 Environment: Websphere 8.5 Windows 7 Reporter: A B Attachments: LOG4J2-747_Jira.war, LOG4J2747_Jira_Sample3.ear, log4j2 location.jpg, log4j2-webapp-error.txt Based on my previous post / question on the log4j2 user list - Defining different log4j2.xml configurations based on environment - http://apache-logging.6191.n7.nabble.com/Defining-different-log4j2-xml-configurations-based-on-environment-tp40639p40662.html - I was attempting to create a Servlet Example of using different log4j2-\{env:envValue\}.xml. Based on the answers in this thread Defining different log4j2.xml configurations based on environment, from log4j user list I tried to test using a different config for different environments. This is what I have done. * I defined a Windows env variable {{websphere_environment}} and set its value to local * I specify the config location as log4j2-\{env:envValue\}.xml. My web.xml context-param looks like below - servlet version is 3.0. {code} context-param param-namelog4jConfigLocation/param-name param-value/WEB-INF/config/log4j2-${env:websphere_environment}.xml /param-value /context-param {code} My relevant servlet method looks like below {code} protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Logger logger = Logger.getLogger(ServletLog4j2Test.class.getName()); logger.fatal(Loaded:); // + /WEB-INF/config/log4j2-${env:websphere_environment}.xml } {code} I do not have the lo4j2-local.xml defined in the WEB-INF/config ( it is defined as log4j-local.xml, not log4j2-local.xml and was expecting to get an error but it seems that the servlet is using a default configuration, because when I run the servlet, I get {code} 07/24/14 07:14:07:564:FATAL:WebContainer : 0:: :com.test.log4j2.ServletLog4j2Test: Loaded: {code} How should my web-app and config files be set-up so that I can use different configs for different environments based on the environment? -- This message was sent by Atlassian JIRA (v6.2#6252) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-747) Servlet Example of using different log4j2-{env:envValue}.xml
[ https://issues.apache.org/jira/browse/LOG4J2-747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14095010#comment-14095010 ] A B commented on LOG4J2-747: So, how should that be used? Can you give me an example? Servlet Example of using different log4j2-{env:envValue}.xml Key: LOG4J2-747 URL: https://issues.apache.org/jira/browse/LOG4J2-747 Project: Log4j 2 Issue Type: Bug Components: Configurators Affects Versions: 2.0-beta9 Environment: Websphere 8.5 Windows 7 Reporter: A B Attachments: LOG4J2-747_Jira.war, LOG4J2747_Jira_Sample3.ear, log4j2 location.jpg, log4j2-webapp-error.txt Based on my previous post / question on the log4j2 user list - Defining different log4j2.xml configurations based on environment - http://apache-logging.6191.n7.nabble.com/Defining-different-log4j2-xml-configurations-based-on-environment-tp40639p40662.html - I was attempting to create a Servlet Example of using different log4j2-\{env:envValue\}.xml. Based on the answers in this thread Defining different log4j2.xml configurations based on environment, from log4j user list I tried to test using a different config for different environments. This is what I have done. * I defined a Windows env variable {{websphere_environment}} and set its value to local * I specify the config location as log4j2-\{env:envValue\}.xml. My web.xml context-param looks like below - servlet version is 3.0. {code} context-param param-namelog4jConfigLocation/param-name param-value/WEB-INF/config/log4j2-${env:websphere_environment}.xml /param-value /context-param {code} My relevant servlet method looks like below {code} protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Logger logger = Logger.getLogger(ServletLog4j2Test.class.getName()); logger.fatal(Loaded:); // + /WEB-INF/config/log4j2-${env:websphere_environment}.xml } {code} I do not have the lo4j2-local.xml defined in the WEB-INF/config ( it is defined as log4j-local.xml, not log4j2-local.xml and was expecting to get an error but it seems that the servlet is using a default configuration, because when I run the servlet, I get {code} 07/24/14 07:14:07:564:FATAL:WebContainer : 0:: :com.test.log4j2.ServletLog4j2Test: Loaded: {code} How should my web-app and config files be set-up so that I can use different configs for different environments based on the environment? -- This message was sent by Atlassian JIRA (v6.2#6252) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-747) Servlet Example of using different log4j2-{env:envValue}.xml
[ https://issues.apache.org/jira/browse/LOG4J2-747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14095015#comment-14095015 ] Remko Popma commented on LOG4J2-747: Matt is right. I thought the error was caused by WebSpere while parsing the web.xml file, but on closer inspection it is caused by Log4j trying to resolve the log4jConfiguration. However, the [source code|http://logging.apache.org/log4j/2.x/log4j-web/xref/org/apache/logging/log4j/web/Log4jWebInitializerImpl.html#83] is doing the lookup so I would expect the $\{env:variable\} to be replaced. Somehow that is not happening... Can you try with a $\{sys:variable\} (for example, set system property {{websphere_environment}}) and let us know if you get the same error? For example: {code} context-param param-namelog4jConfiguration/param-name param-value/WEB-INF/config2/log4j2_${sys:websphere_environment}.xml/param-value /context-param {code} Servlet Example of using different log4j2-{env:envValue}.xml Key: LOG4J2-747 URL: https://issues.apache.org/jira/browse/LOG4J2-747 Project: Log4j 2 Issue Type: Bug Components: Configurators Affects Versions: 2.0-beta9 Environment: Websphere 8.5 Windows 7 Reporter: A B Attachments: LOG4J2-747_Jira.war, LOG4J2747_Jira_Sample3.ear, log4j2 location.jpg, log4j2-webapp-error.txt Based on my previous post / question on the log4j2 user list - Defining different log4j2.xml configurations based on environment - http://apache-logging.6191.n7.nabble.com/Defining-different-log4j2-xml-configurations-based-on-environment-tp40639p40662.html - I was attempting to create a Servlet Example of using different log4j2-\{env:envValue\}.xml. Based on the answers in this thread Defining different log4j2.xml configurations based on environment, from log4j user list I tried to test using a different config for different environments. This is what I have done. * I defined a Windows env variable {{websphere_environment}} and set its value to local * I specify the config location as log4j2-\{env:envValue\}.xml. My web.xml context-param looks like below - servlet version is 3.0. {code} context-param param-namelog4jConfigLocation/param-name param-value/WEB-INF/config/log4j2-${env:websphere_environment}.xml /param-value /context-param {code} My relevant servlet method looks like below {code} protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Logger logger = Logger.getLogger(ServletLog4j2Test.class.getName()); logger.fatal(Loaded:); // + /WEB-INF/config/log4j2-${env:websphere_environment}.xml } {code} I do not have the lo4j2-local.xml defined in the WEB-INF/config ( it is defined as log4j-local.xml, not log4j2-local.xml and was expecting to get an error but it seems that the servlet is using a default configuration, because when I run the servlet, I get {code} 07/24/14 07:14:07:564:FATAL:WebContainer : 0:: :com.test.log4j2.ServletLog4j2Test: Loaded: {code} How should my web-app and config files be set-up so that I can use different configs for different environments based on the environment? -- This message was sent by Atlassian JIRA (v6.2#6252) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-747) Servlet Example of using different log4j2-{env:envValue}.xml
[ https://issues.apache.org/jira/browse/LOG4J2-747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14092070#comment-14092070 ] Remko Popma commented on LOG4J2-747: Does this problem happen only with web applications or also with standalone apps? Can the problem be reproduced in other web containers than Websphere 8.5? Servlet Example of using different log4j2-{env:envValue}.xml Key: LOG4J2-747 URL: https://issues.apache.org/jira/browse/LOG4J2-747 Project: Log4j 2 Issue Type: Bug Components: Configurators Affects Versions: 2.0-beta9 Environment: Websphere 8.5 Windows 7 Reporter: A B Attachments: LOG4J2-747_Jira.war, LOG4J2747_Jira_Sample3.ear Based on my previous post / question on the log4j2 user list - Defining different log4j2.xml configurations based on environment - http://apache-logging.6191.n7.nabble.com/Defining-different-log4j2-xml-configurations-based-on-environment-tp40639p40662.html - I was attempting to create a Servlet Example of using different log4j2-\{env:envValue\}.xml. Based on the answers in this thread Defining different log4j2.xml configurations based on environment, from log4j user list I tried to test using a different config for different environments. This is what I have done. * I defined a Windows env variable {{websphere_environment}} and set its value to local * I specify the config location as log4j2-\{env:envValue\}.xml. My web.xml context-param looks like below - servlet version is 3.0. {code} context-param param-namelog4jConfigLocation/param-name param-value/WEB-INF/config/log4j2-${env:websphere_environment}.xml /param-value /context-param {code} My relevant servlet method looks like below {code} protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Logger logger = Logger.getLogger(ServletLog4j2Test.class.getName()); logger.fatal(Loaded:); // + /WEB-INF/config/log4j2-${env:websphere_environment}.xml } {code} I do not have the lo4j2-local.xml defined in the WEB-INF/config ( it is defined as log4j-local.xml, not log4j2-local.xml and was expecting to get an error but it seems that the servlet is using a default configuration, because when I run the servlet, I get {code} 07/24/14 07:14:07:564:FATAL:WebContainer : 0:: :com.test.log4j2.ServletLog4j2Test: Loaded: {code} How should my web-app and config files be set-up so that I can use different configs for different environments based on the environment? -- This message was sent by Atlassian JIRA (v6.2#6252) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-747) Servlet Example of using different log4j2-{env:envValue}.xml
[ https://issues.apache.org/jira/browse/LOG4J2-747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14092121#comment-14092121 ] A B commented on LOG4J2-747: I will try to answer for both the comments above I could not get param-value/WEB-INF/config/log4j2.xml/param-value to work. I am adding only the log4jConfiguration context param context-param param-namelog4jConfiguration/param-name param-value/WEB-INF/config/log4j2.xml/param-value /context-param I wasn't sure, reading from the documentation that when I want to use the non-default location / filename for a servlet 3.0 web-app, whether I need to define other context params as well. From the documentation it appeared that if I set isLog4jAutoInitializationDisabled=true, then only I need to define the contextinitializer and filter. Is my understanding correct or wanting to define a non-default configuration file, in itself mandates defining the other context params as well. If I do need to define the other params, will you please let me know what I MUST define in my web.xml to make this work? For Standalone, I was able to use a config that was named differently from log4j2.xml or log4j2-test.xml. Using the environment variable in the system parameter for standalone - like thus - log4j.configurationFile=file:///Z:\\RAD85_WS\\ITWeb\\Log4jSamplesStandAlone\\log4j2config\\log4j2_${env:websphere_environment}.xml - generates an error, maybe I need to pass the parameter in a different way for this? I do not have access to other web containers, so haven't tested it against them. Please let me know, if I am doing something wrong, or missing some required set-ups. Thanks, Servlet Example of using different log4j2-{env:envValue}.xml Key: LOG4J2-747 URL: https://issues.apache.org/jira/browse/LOG4J2-747 Project: Log4j 2 Issue Type: Bug Components: Configurators Affects Versions: 2.0-beta9 Environment: Websphere 8.5 Windows 7 Reporter: A B Attachments: LOG4J2-747_Jira.war, LOG4J2747_Jira_Sample3.ear Based on my previous post / question on the log4j2 user list - Defining different log4j2.xml configurations based on environment - http://apache-logging.6191.n7.nabble.com/Defining-different-log4j2-xml-configurations-based-on-environment-tp40639p40662.html - I was attempting to create a Servlet Example of using different log4j2-\{env:envValue\}.xml. Based on the answers in this thread Defining different log4j2.xml configurations based on environment, from log4j user list I tried to test using a different config for different environments. This is what I have done. * I defined a Windows env variable {{websphere_environment}} and set its value to local * I specify the config location as log4j2-\{env:envValue\}.xml. My web.xml context-param looks like below - servlet version is 3.0. {code} context-param param-namelog4jConfigLocation/param-name param-value/WEB-INF/config/log4j2-${env:websphere_environment}.xml /param-value /context-param {code} My relevant servlet method looks like below {code} protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Logger logger = Logger.getLogger(ServletLog4j2Test.class.getName()); logger.fatal(Loaded:); // + /WEB-INF/config/log4j2-${env:websphere_environment}.xml } {code} I do not have the lo4j2-local.xml defined in the WEB-INF/config ( it is defined as log4j-local.xml, not log4j2-local.xml and was expecting to get an error but it seems that the servlet is using a default configuration, because when I run the servlet, I get {code} 07/24/14 07:14:07:564:FATAL:WebContainer : 0:: :com.test.log4j2.ServletLog4j2Test: Loaded: {code} How should my web-app and config files be set-up so that I can use different configs for different environments based on the environment? -- This message was sent by Atlassian JIRA (v6.2#6252) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-747) Servlet Example of using different log4j2-{env:envValue}.xml
[ https://issues.apache.org/jira/browse/LOG4J2-747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14092343#comment-14092343 ] Remko Popma commented on LOG4J2-747: Formatting tips: # Multi-line code or configuration snippets: put the word \{code\} on a single line, then your snippet, then the word \{code\} again on a separate line. # Within a sentence you can surround a phrase with \{\{ and \}\} to mark it as {{monotype}} # Furthermore, when editing a comment, there is a little blue square (tooltip: preview) that shows how your comment will look on the page, and a (?) mark that brings up a window with more formatting help Servlet Example of using different log4j2-{env:envValue}.xml Key: LOG4J2-747 URL: https://issues.apache.org/jira/browse/LOG4J2-747 Project: Log4j 2 Issue Type: Bug Components: Configurators Affects Versions: 2.0-beta9 Environment: Websphere 8.5 Windows 7 Reporter: A B Attachments: LOG4J2-747_Jira.war, LOG4J2747_Jira_Sample3.ear Based on my previous post / question on the log4j2 user list - Defining different log4j2.xml configurations based on environment - http://apache-logging.6191.n7.nabble.com/Defining-different-log4j2-xml-configurations-based-on-environment-tp40639p40662.html - I was attempting to create a Servlet Example of using different log4j2-\{env:envValue\}.xml. Based on the answers in this thread Defining different log4j2.xml configurations based on environment, from log4j user list I tried to test using a different config for different environments. This is what I have done. * I defined a Windows env variable {{websphere_environment}} and set its value to local * I specify the config location as log4j2-\{env:envValue\}.xml. My web.xml context-param looks like below - servlet version is 3.0. {code} context-param param-namelog4jConfigLocation/param-name param-value/WEB-INF/config/log4j2-${env:websphere_environment}.xml /param-value /context-param {code} My relevant servlet method looks like below {code} protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Logger logger = Logger.getLogger(ServletLog4j2Test.class.getName()); logger.fatal(Loaded:); // + /WEB-INF/config/log4j2-${env:websphere_environment}.xml } {code} I do not have the lo4j2-local.xml defined in the WEB-INF/config ( it is defined as log4j-local.xml, not log4j2-local.xml and was expecting to get an error but it seems that the servlet is using a default configuration, because when I run the servlet, I get {code} 07/24/14 07:14:07:564:FATAL:WebContainer : 0:: :com.test.log4j2.ServletLog4j2Test: Loaded: {code} How should my web-app and config files be set-up so that I can use different configs for different environments based on the environment? -- This message was sent by Atlassian JIRA (v6.2#6252) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-747) Servlet Example of using different log4j2-{env:envValue}.xml
[ https://issues.apache.org/jira/browse/LOG4J2-747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14083548#comment-14083548 ] A B commented on LOG4J2-747: Is there any update on this? Is there something else, I can do from my side? Thanks Servlet Example of using different log4j2-{env:envValue}.xml Key: LOG4J2-747 URL: https://issues.apache.org/jira/browse/LOG4J2-747 Project: Log4j 2 Issue Type: Bug Components: Configurators Affects Versions: 2.0-beta9 Environment: Websphere 8.5 Windows 7 Reporter: A B Attachments: LOG4J2-747_Jira.war, LOG4J2747_Jira_Sample3.ear Based on my previous post / question on the log4j2 user list - Defining different log4j2.xml configurations based on environment - http://apache-logging.6191.n7.nabble.com/Defining-different-log4j2-xml-configurations-based-on-environment-tp40639p40662.html - I was attempting to create a Servlet Example of using different log4j2-\{env:envValue\}.xml. Based on the answers in this thread Defining different log4j2.xml configurations based on environment, from log4j user list I tried to test using a different config for different environments. This is what I have done. * I defined a Windows env variable {{websphere_environment}} and set its value to local * I specify the config location as log4j2-\{env:envValue\}.xml. My web.xml context-param looks like below - servlet version is 3.0. {code} context-param param-namelog4jConfigLocation/param-name param-value/WEB-INF/config/log4j2-${env:websphere_environment}.xml /param-value /context-param {code} My relevant servlet method looks like below {code} protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Logger logger = Logger.getLogger(ServletLog4j2Test.class.getName()); logger.fatal(Loaded:); // + /WEB-INF/config/log4j2-${env:websphere_environment}.xml } {code} I do not have the lo4j2-local.xml defined in the WEB-INF/config ( it is defined as log4j-local.xml, not log4j2-local.xml and was expecting to get an error but it seems that the servlet is using a default configuration, because when I run the servlet, I get {code} 07/24/14 07:14:07:564:FATAL:WebContainer : 0:: :com.test.log4j2.ServletLog4j2Test: Loaded: {code} How should my web-app and config files be set-up so that I can use different configs for different environments based on the environment? -- This message was sent by Atlassian JIRA (v6.2#6252) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-747) Servlet Example of using different log4j2-{env:envValue}.xml
[ https://issues.apache.org/jira/browse/LOG4J2-747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14083848#comment-14083848 ] Remko Popma commented on LOG4J2-747: Sorry, i have not had time to look at this and I may not have time next week either. If you are looking at things you can do to help with investigation, I would try specifying several values in web.xml and let us know the results: One thing I noticed: in your example web.xml the value may contain a newline (the closing {{/param-value}} is on the next line). Try with {{param-valueYOURVALUE/param-value}} (without newlines in the value). Other things to try: * Does the basic config work correctly? First make sure that a simple value like {{param-value/WEB-INF/config/log4j2.xml/param-value}} works correctly. Once that works, we can try substituting part of the path with environment variables. * If that works correctly, try setting a system property and see if configuring web.xml with {{param-value/WEB-INF/config/log4j2-$\{sys:websphere_environment\}.xml/param-value}} works. If it does then perhaps the environment variable is spelled differently, or log4j2 has trouble picking up the value. That gives a clue for which direction to investigate. Servlet Example of using different log4j2-{env:envValue}.xml Key: LOG4J2-747 URL: https://issues.apache.org/jira/browse/LOG4J2-747 Project: Log4j 2 Issue Type: Bug Components: Configurators Affects Versions: 2.0-beta9 Environment: Websphere 8.5 Windows 7 Reporter: A B Attachments: LOG4J2-747_Jira.war, LOG4J2747_Jira_Sample3.ear Based on my previous post / question on the log4j2 user list - Defining different log4j2.xml configurations based on environment - http://apache-logging.6191.n7.nabble.com/Defining-different-log4j2-xml-configurations-based-on-environment-tp40639p40662.html - I was attempting to create a Servlet Example of using different log4j2-\{env:envValue\}.xml. Based on the answers in this thread Defining different log4j2.xml configurations based on environment, from log4j user list I tried to test using a different config for different environments. This is what I have done. * I defined a Windows env variable {{websphere_environment}} and set its value to local * I specify the config location as log4j2-\{env:envValue\}.xml. My web.xml context-param looks like below - servlet version is 3.0. {code} context-param param-namelog4jConfigLocation/param-name param-value/WEB-INF/config/log4j2-${env:websphere_environment}.xml /param-value /context-param {code} My relevant servlet method looks like below {code} protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Logger logger = Logger.getLogger(ServletLog4j2Test.class.getName()); logger.fatal(Loaded:); // + /WEB-INF/config/log4j2-${env:websphere_environment}.xml } {code} I do not have the lo4j2-local.xml defined in the WEB-INF/config ( it is defined as log4j-local.xml, not log4j2-local.xml and was expecting to get an error but it seems that the servlet is using a default configuration, because when I run the servlet, I get {code} 07/24/14 07:14:07:564:FATAL:WebContainer : 0:: :com.test.log4j2.ServletLog4j2Test: Loaded: {code} How should my web-app and config files be set-up so that I can use different configs for different environments based on the environment? -- This message was sent by Atlassian JIRA (v6.2#6252) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-747) Servlet Example of using different log4j2-{env:envValue}.xml
[ https://issues.apache.org/jira/browse/LOG4J2-747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14075510#comment-14075510 ] A B commented on LOG4J2-747: FYI. I also tried with absolute path, the results were the same Servlet Example of using different log4j2-{env:envValue}.xml Key: LOG4J2-747 URL: https://issues.apache.org/jira/browse/LOG4J2-747 Project: Log4j 2 Issue Type: Bug Components: Configurators Affects Versions: 2.0-beta9 Environment: Websphere 8.5 Windows 7 Reporter: A B Attachments: LOG4J2-747_Jira.war, LOG4J2747_Jira_Sample3.ear Based on my previous post / question on the log4j2 user list - Defining different log4j2.xml configurations based on environment - http://apache-logging.6191.n7.nabble.com/Defining-different-log4j2-xml-configurations-based-on-environment-tp40639p40662.html - I was attempting to create a Servlet Example of using different log4j2-\{env:envValue\}.xml. Based on the answers in this thread Defining different log4j2.xml configurations based on environment, from log4j user list I tried to test using a different config for different environments. This is what I have done. * I defined a Windows env variable {{websphere_environment}} and set its value to local * I specify the config location as log4j2-\{env:envValue\}.xml. My web.xml context-param looks like below - servlet version is 3.0. {code} context-param param-namelog4jConfigLocation/param-name param-value/WEB-INF/config/log4j2-${env:websphere_environment}.xml /param-value /context-param {code} My relevant servlet method looks like below {code} protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Logger logger = Logger.getLogger(ServletLog4j2Test.class.getName()); logger.fatal(Loaded:); // + /WEB-INF/config/log4j2-${env:websphere_environment}.xml } {code} I do not have the lo4j2-local.xml defined in the WEB-INF/config ( it is defined as log4j-local.xml, not log4j2-local.xml and was expecting to get an error but it seems that the servlet is using a default configuration, because when I run the servlet, I get {code} 07/24/14 07:14:07:564:FATAL:WebContainer : 0:: :com.test.log4j2.ServletLog4j2Test: Loaded: {code} How should my web-app and config files be set-up so that I can use different configs for different environments based on the environment? -- This message was sent by Atlassian JIRA (v6.2#6252) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org