1 2 3 Previous Next 37 Replies Latest reply on Dec 6, 2012 5:39 PM by jamezp Go to original post
      • 30. Re: How to setup log4j in JBoss AS7
        ybxiang.china

        I am sure jboss-logging is OK.

         

        Can you fllow bellow steps and post more details?

         

        1.  ZIP your JBoss that works well on windows (including your xxx.ear), UNZIP it on Linux with root account.

        2. chmod +x * in bin directory

        3. start your jboss

         

        What is the result?

        • 31. Re: How to setup log4j in JBoss AS7
          ybxiang.china

          You had better to change your method to:

           

               public List<Orders> findByOrderId(Integer orderId) {

          log.info("test...");
          log.info("test...");

          log.info("test...");

          log.info("test...");

          log.info("test...");

               }

           

          JUst for test,  why NOT make your code cleaner?

          • 32. Re: How to setup log4j in JBoss AS7
            ybxiang.china

            1. Why NOT try my logging setting in standalone.xml (I tested in jboss 7.2.0-alpha1) ?

            (I had made jboss logging work in jboss 7.1.1, But I am NOT sure if the settings are the same.)

             

            You just need to change <logger category="SOCKET_TRACING" use-parent-handlers="false"> to <logger category="com.incomm" use-parent-handlers="false">

             

            If my setting works well, then you can adjust it line by line (and throw your setting).

             

             

             

             

             

             

            2.  Are you sure that your logging setting is correct???

             

            I think your setting missed something.

             

            <profile>

                    #Here, there should be <subsystem xmlns="urn:jboss:domain:logging:1.1"... #

                    <size-rotating-file-handler name="wms-logger">

                        ...

            • 33. Re: How to setup log4j in JBoss AS7
              ybxiang.china

              Thanks for your help!

               

              I tried using JBoss Logging on my local machine and it did work!  That's the good news. 

              ~~~~~~~~~~~~Are you sure? Please remove this file, restart your jboss and check the file content agian on your local machine. Please print more lines in constructor or @PostConstruct method.

               

              The bad news is that I cannot get it to work on my company's DEV and TST environments.  I have double-checked the configuration many times and it is the exact same.

              ~~~~~~~~~~~~"double-checked" what?  why NOT copy your jboss (including xxx.ear) directly to your DEV and TST environments???

               

               

              I tried many things on my Local machine so maybe it was something else which finally got logging to work.  On DEV and TST, I following the above directions exactly. I wonder if there's a missing step?

               

              The other Software Engineers on my team do NOT like the idea of using JBoss logging because this way our code is tied to a specific App Server.  We use other App Servers (such as Glassfish) and that is why log4j is nice because it doesn't matter which App Server is used.

              ~~~~~~~~~~~~Are you sure you will migrate your application to Glassfish??? If you decided to use jboss, then forget Glassfish. Vice versa. Actually, I never met such a case in practice.

                                          If you do WANT to do so, I think you can try JDK logger instead of log4j. It is NOT easy to make log4j work in Glassfish too!


               

              At this point, in-order to meet the project deadline, I will probably put "System.out.println()", because we need those logging statements!

              • 34. Re: How to setup log4j in JBoss AS7
                ybxiang.china

                The initial jboss-logging setting is:

                 

                <profile>
                    <subsystem xmlns="urn:jboss:domain:logging:1.1">
                        <console-handler name="CONSOLE">
                            <level name="INFO"/>
                            <formatter>
                                <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
                            </formatter>
                        </console-handler>
                        <periodic-rotating-file-handler name="FILE">
                            <formatter>
                                <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
                            </formatter>
                            <file relative-to="jboss.server.log.dir" path="server.log"/>
                            <suffix value=".yyyy-MM-dd"/>
                            <append value="true"/>
                        </periodic-rotating-file-handler>
                        <logger category="com.arjuna">
                            <level name="WARN"/>
                        </logger>
                        <logger category="org.apache.tomcat.util.modeler">
                            <level name="WARN"/>
                        </logger>
                        <logger category="sun.rmi">
                            <level name="WARN"/>
                        </logger>
                        <logger category="jacorb">
                            <level name="WARN"/>
                        </logger>
                        <logger category="jacorb.config">
                            <level name="ERROR"/>
                        </logger>
                        <root-logger>
                            <level name="INFO"/>
                            <handlers>
                                <handler name="CONSOLE"/>
                                <handler name="FILE"/>
                            </handlers>
                        </root-logger>
                    </subsystem>

                 

                 

                You configuration is different with it completely.

                 

                I suggest you do NOT change too much at one time unless you are an expert!

                • 35. Re: How to setup log4j in JBoss AS7
                  ybxiang.china

                  step.1: do NOT change default jboss logging configuration  in standalone.xml. Make sure your log can be printed into server.log( on local machine and DEV/TEST machine).

                   

                  step.2: change it according my configuration posted in page1.

                  (replace "SOCKET_TRACING" with your "com.xxx.yyy" in both standalone.xml file and java code)

                   

                  step.3: change it according to your request.

                   

                   

                  Good luck, poor guy.

                   

                   

                   

                   

                   

                  我一个中国人,用英语跟你解释这么多,我也很可怜啊!

                  • 36. Re: How to setup log4j in JBoss AS7
                    davidj

                    Nothing has worked, log4j didn't work, JBoss logging didn't work.

                    I've worked with many projects over the years, and this is the first time I've never gotten logging to work.

                     

                    But the good news is that I finally found a solution:  I used java.util.logging, and now logging is working fine.

                    • 37. Re: How to setup log4j in JBoss AS7
                      jamezp

                      Something sounds very odd with that. Is there anyway to attach a stripped down project that doesn't work? I'd really like to debug and see if there is a bug. I'd hate to force anyone to use JUL :-)

                       

                      --

                      James R. Perkins

                      1 2 3 Previous Next