1 2 Previous Next 19 Replies Latest reply on Dec 24, 2013 9:00 AM by chaithu.nck Go to original post
      • 15. Re: properties not working in jboss-logging.xml of AS 6
        petal1

        OK, I can confirm - log4j-appenders do not work in 6.1.0.Final.

        Applying patch JBAS-8791 helped - at least my log4j file appender now works, but as soon as I add in another log4j-appender into jboss-logging.xml, that second appender does not appear to work and also the file appender stops working too!

        The second appender that stops everything working is defined as:

         

            <log4j-appender name="MYRMI" class="com.myco.MyRMIAppender">

                <error-manager>

                    <only-once/>

                </error-manager>

                <level name="ERROR"/>

                <properties>

                   <property name="rMIPort">1097</property>

                   <property name="rMIServer">10.1.2.3</property>

                   <property name="rMITargetBindName">bob</property>

               </properties>

            </log4j-appender>

         

        com.myco.MyRMIAppender extends org.apache.log4j.AppenderSkeleton.

         

        I had to lower case the first letter of each of the properties of my file appender, so I did the same with this one. I put a debug line in the static initializer of com.myco.MyRMIAppender but I don't see it anywhere (not really sure where I would see it though).

         

        Any reason why the addition of the above log4j-appender would not work (and cause the file appender to stop too)? OK, I'm not really expecting an answer; I've learnt that this forum doesn't get a lot of useful posts, but I'll keep looking and post the answer here if/when I find it to try to help other frustrated users of the rather buggy jboss logging.

         

        Paul.

        • 16. Re: properties not working in jboss-logging.xml of AS 6
          petal1

          I do see the debug message I put in the static initializer of MyRMIAppender. I also put debug in all the property setters of MyRMIAppender, but I only see one of those debug messages. Could it be that one of the setters is failing? I'm not seeing any report of such an error in boot.log.

          • 17. Re: properties not working in jboss-logging.xml of AS 6
            petal1

            In case it helps someone else, the problem is the case of the property names.

             

            If you have an appender class with a setter called setThisProperty, then the property in the jboss-logging.xml file should be "thisProperty".

             

            But if you have a setter called setRMIPort (as I have) then you may conclude that your property should be called rMIPort. That will not work, and none of your appenders will work as a result.

             

            If you change that setter to setRmiPort, and call the property rmiPort, then all will be well.

             

            I'm not sure what the logic is in the relationship between property names and the setters, but it appears flawed (and undocumented, as usual).

             

            Paul

            • 18. Re: properties not working in jboss-logging.xml of AS 6
              chaithu.nck

              Hi Jeff,

                 Thanks for your post. How did you manage to get past the JBoss start-up issue that you mentioned? I'm facing the same issue as yours and I've tried applying the patches described in https://issues.jboss.org/browse/JBAS-8791 , but no luck. I'm using AS Jboss-6.1.0-Final, and all I did was downloading a fresh copy of it, verified if it starts properly (it does) and changed jboss-logging.xml to add a log4j appender as instructed by you, in my default server profile. The server doesn't boot completely. It stops at the same point as yours - ' [service] Removing bootstrap log handlers'. Can you please guide me here? I've tried searching all over and couldn't find a working solution. I need to configure log4j appenders as my application is dependent on org.apache.log4j badly.

              • 19. Re: properties not working in jboss-logging.xml of AS 6
                chaithu.nck

                I managed to get past my issue by using the exact content of jboss-logging.xml from your re-post in this discussion. Earlier, I was using the 'MYTEMPFILE' example from this link https://community.jboss.org/thread/163004 . Somehow, the server wasn't liking the content from that link, could be some error in the definition. Also, had to apply the patch from [JBAS-8791] log4j-appender seems not working in jboss-logging (AS6 final) - JBoss Issue Tracker (copied only logging-service-metadata.jar though).

                 

                But I couldn't get my application use log4j's Logger. When I try getLogger(clazz.name), it still returns me the nasty 'BridgeLogger' error as below:

                Caused by: java.lang.ClassCastException: org.jboss.logmanager.log4j.BridgeLogger cannot be cast to myapp.logging.MyLogger

                 

                Thanks,

                Chaithu.

                1 2 Previous Next