4 Replies Latest reply on Sep 3, 2014 6:59 PM by Renato Resende Ribeiro de Oliveira

    How to separate application logging from server.log in JBossEAP6.2.0

    bharath kumar Newbie

      The server is not considering application log4j properties.All log entries are storing in server.log,Please guide to me how to separate server related logs and application related logs.

        • 1. Re: How to separate application logging from server.log in JBossEAP6.2.0
          James Perkins Master

          Where is your log4j.properties located? If you want the server to configure it it needs to be in the META-INF of an EAR or WEB-INF/classes of a WAR.

           

          --

          James R. Perkins

          • 2. Re: How to separate application logging from server.log in JBossEAP6.2.0
            Wolf-Dieter Fink Master

            A simple way is to have no logging configuration within the application. Just add a new handler and a logging category wired to this handler for your application. In this case only your handler is used for your applicaton.

            • 3. Re: How to separate application logging from server.log in JBossEAP6.2.0
              bharath kumar Newbie

              The property file is inside source folder structure(src/com/test) and configured in web.xml. i want application level logging..So, please suggest.The same is working fine i deployed in tomcat server.

              • 4. Re: How to separate application logging from server.log in JBossEAP6.2.0
                Renato Resende Ribeiro de Oliveira Newbie

                The JBoss logging is the worst thing i ever seem in the application servers and servlet containers.

                The Tomcat doesn't have it's own logging system, so it will load your app configuration fine without any problem.

                 

                The EAP scans your deployment for a log4j.properties or log4j.xml. If it founds one of these, the EAP will try to use the configurations in that file, but this doesn't work well.

                For example, i coulndn't make the EAP show my app logs in the console, only if i configure it directly in the domain.xml or standalone.xml.

                 

                The easiest way i suggest you is to create a new handler in the standalone.xml logging subsystem config. So create a new logger for your apps category and points it to the new file handler that collects all messages coming  from your app. For this to work you have to remove your log4j.properties file from the deployment.

                 

                Another option that i did not test is to prevent the loading of the logging subsystem via the jboss-deployment-structure.xml file, that must be located at WEB-INF folder, along the web.xml. In the content:

                <jboss-deployment-structure> 

                    <deployment> 

                        <!-- Exclusions allow you to prevent the server from automatically adding some dependencies --> 

                        <exclusions> 

                            <module name="org.apache.log4j" />

                        </exclusions> 

                    </deployment> 

                </jboss-deployment-structure>

                With this file, you should have to just configure the file appender in your log4j configuration and points your app category to this new appender.

                Remember, i didn't test this approach, i see it on the internet. You may have to search some more info out there.

                 

                Regards