Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-7584

MDCSiftingAppender with custom Sift keys fails randomly to append to appropriate log files after fabric child container restarts

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Done
    • Affects Version/s: jboss-fuse-6.3
    • Fix Version/s: jboss-fuse-6.3-patches
    • Component/s: Fabric8 v1
    • Labels:
      None
    • Environment:

      JBoss Fuse 6.3 R5 fabric

    • Steps to Reproduce:
      Hide

      1. Unzip the testcase.zip to your local file system;
      2. go to the project "mdcProfile" and build entire project by "mvn install";
      3. create a fabric and then create a child container with "gateway-http" profile:
      container-create-child --profile gateway-http root gateway
      4. create another child container called "child";
      container-create-child root child
      5. import the profile with command"
      profile-import file:/local/testcase/01917967/spring/mdcProfile/target/mdcProfile-1.0-solution.zip
      6. add the profile "mdc" to the child container "child"
      container-add-profile child mdc
      7. then go to the child container's log folder "jboss-fuse-6.3.0.redhat-310/instances/child/data/log/", you will see the only log file "fuse.log" since I only had "MDCSiftingAppender" logger enabled but not the default "RollingFileAppender".
      8. send a HTTP request using "curl" command:
      curl -H "Accept: application/json" -X GET http://localhost:8183/cxf/CxfRsRouterTest/route/customerservice/customers/123
      and you will see these two new log files created "mywebproxy.log" and "mywebsrv.log.
      9. restart the child container with command "container-stop child" and then "container-start child". You will see a file ".log" created without any prefix.
      10. repeat the step #8 to send another request using utility "curl" to the service and then check for the two application specific log files "mywebproxy.log" and "mywebsrv.log. The MDCSiftingAppender fails randomly putting logs to the two application logs. Instead, those logs are always sent to the log file ".log".
      11. If the steps #10 works somehow, then just repeat the step #9 and #10. It will fail randomly.

      Show
      1. Unzip the testcase.zip to your local file system; 2. go to the project "mdcProfile" and build entire project by "mvn install"; 3. create a fabric and then create a child container with "gateway-http" profile: container-create-child --profile gateway-http root gateway 4. create another child container called "child"; container-create-child root child 5. import the profile with command" profile-import file:/local/testcase/01917967/spring/mdcProfile/target/mdcProfile-1.0-solution.zip 6. add the profile "mdc" to the child container "child" container-add-profile child mdc 7. then go to the child container's log folder "jboss-fuse-6.3.0.redhat-310/instances/child/data/log/", you will see the only log file "fuse.log" since I only had "MDCSiftingAppender" logger enabled but not the default "RollingFileAppender". 8. send a HTTP request using "curl" command: curl -H "Accept: application/json" -X GET http://localhost:8183/cxf/CxfRsRouterTest/route/customerservice/customers/123 and you will see these two new log files created "mywebproxy.log" and "mywebsrv.log. 9. restart the child container with command "container-stop child" and then "container-start child". You will see a file ".log" created without any prefix. 10. repeat the step #8 to send another request using utility "curl" to the service and then check for the two application specific log files "mywebproxy.log" and "mywebsrv.log. The MDCSiftingAppender fails randomly putting logs to the two application logs. Instead, those logs are always sent to the log file ".log". 11. If the steps #10 works somehow, then just repeat the step #9 and #10. It will fail randomly.

      Description

      I have a project that uses MDCSiftingAppender with custom Sift keys so each application (might consist of multiple bundles) will log to their own log file depending on the custom Sift key/value pair.

      After deploying the profile to a fabric child container, everything works fine. And logs are appended to appropriate application specific logs.

      However, after the fabric child container restarts, it appears that there are two issues:
      1. there is always a ".log" file created without any prefix;
      2. the MDCSiftingAppender fails randomly in terms of appending to application specific logs based on the custom Sift key/value pair. It sometimes fails by appending all application specific logs to the ".log" file (fails) and other times, it works fine by appending to application specific logs.

      The application in question has three bundles and one is a common bundle (common-bundle) with all common Java classes that might be used by different bundles/applications. The second one is a camel route using camel cxfrs endpoint as a proxy (camel-cxfrs-spring). The third one is a bundle using cxf jaxrs endpoint for JAXRS server implementation (jaxrs-server-spring).

      The "camel-cxfrs-spring" bundle uses camel MDC logging and custom UnitOfWork and UnitOfWorkFactory. The "jaxrs-server-spring" uses CXF interceptor to add and remove MDC key/value pair if necessary.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  grgrzybek Grzegorz Grzybek
                  Reporter:
                  joe.luo Joe Luo
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: