Uploaded image for project: 'Grouper'
  1. Grouper
  2. GRP-2798

change container to slf4j .25

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Unresolved
    • Minor
    • 2.5.34
    • None
    • None
    • None

    Description

      Andy Morgan(opens in new tab) Yesterday at 4:59 PM
      I've got another weird one... We have 2 custom changelog consumers that we have been using for a long time. When trying to validate that they work correctly in v2.5, I've discovered that I can't get DEBUG logs out of them anymore. This worked in v2.4. Our consumers do the following:
      package edu.oregonstate.iam.grouper.consumers;
      import org.slf4j.Logger;
      import org.slf4j.LoggerFactory;
      ...
      public class KalturaChangeLogConsumer extends ChangeLogConsumerBase {
      static Logger logger = LoggerFactory.getLogger(KalturaChangeLogConsumer.class);
      ...
      logger.debug("Read config.properties: kalturaServiceUrl="+kalturaConfig.getServiceUrl());
      And our log4j.properties is mostly baseline, but I added this:
      log4j.logger.edu.oregonstate.iam.grouper.consumers = DEBUG
      Which gives me output from v2.4 but not from v2.5.23. (edited)

       

       

      Shilen Patel(opens in new tab) 1 day ago
      That uses slf4j? I also noticed that the google provisioner which uses slf4j doesn't log properly. Haven't looked into it yet though.

      Shilen Patel(opens in new tab) 1 day ago
      But might be worth checking if org.apache.commons.logging.Log works?

      Andy Morgan(opens in new tab) 1 day ago
      Yeah, this is using slf4j

      Andy Morgan(opens in new tab) 1 day ago
      I added more details to the first post in this thread, btw

      Chris Hyzer(opens in new tab) 1 day ago
      I think tomee uses slf4j, so maybe you need to put a debug statement in its logfile? annoying. i wish everyone would use commons logging like grouper uses so we only need to support one logging framework. i think pspng might be in the same boat unfortunately...

      Chris Hyzer(opens in new tab) 1 day ago
      think you could either customize tomees logging config or switch to commons logging? :slightly_smiling_face:

      Andy Morgan(opens in new tab) 1 day ago
      In v2.5:
      ./lib/slf4j-jdk14-1.7.21.jar
      ./lib/slf4j-api-1.7.21.jar
      ./lib/slf4j-log4j12-1.7.21.jar
      In v2.4:
      ./lib/grouper/slf4j-log4j12.jar
      ./lib/grouper/slf4j-api-1.7.25.jar
      ./lib/custom/slf4j-log4j12-1.7.25.jar
      Older jars in v2.5?

      Andy Morgan(opens in new tab) 1 day ago
      I don't think I understand your statement about tomee, but I'll go try to figure it out... :slightly_smiling_face:

      Andy Morgan(opens in new tab) 1 day ago
      BTW, we could probably switch to a different logging framework in our consumers. They aren't that complicated.

      Andy Morgan(opens in new tab) 1 day ago
      Is there a "template" for a consumer? These consumers were written more than 5 years ago by a developer that doesn't work for us anymore, so I have no idea what she based them on originally.

      Chris Hyzer(opens in new tab) 1 day ago
      commons logging would be the best right now. the tomee log config is xml i believe

      Chris Hyzer(opens in new tab) 1 day ago
      we should make a consumer, template things have changed. want to send me the code and i can make suggesitons? :slightly_smiling_face: (edited)

      Andy Morgan(opens in new tab) 1 day ago
      Sure. What is your email address?

      Andy Morgan(opens in new tab) 1 day ago
      this code is currently in a private repo, so I don't have an easy way to share except send the file...

      Andy Morgan(opens in new tab) 1 day ago
      or send it to me in a direct message, if you want

      Andy Morgan(opens in new tab) 1 day ago
      I can't get DEBUG logs from pspng in v2.5 either (confirming Shilen's observation)

      Andy Morgan(opens in new tab) 1 day ago
      I emailed you, Chris.

      Chris Hyzer(opens in new tab) 1 day ago
      I updated this wiki with my recommendation... yours look pretty good though. :slightly_smiling_face:
      https://spaces.at.internet2.edu/display/Grouper/Sample+change+log+consumer
      it will be even easier once we get the new provisioning framework working, but that might help you if you want to tweak it :slightly_smiling_face:

      Andy Morgan(opens in new tab) 7 hours ago
      I was able to get DEBUG level logging working again by replacing the slf4j v1.7.21 jars with v1.7.25 jars. My Dockerfile looks like this:
      RUN rm /opt/grouper/grouperWebapp/WEB-INF/libUiAndDaemon/box-java-sdk-2.17.0.jar \
      /opt/tomee/lib/slf4j-jdk14-1.7.21.jar \
      /opt/tomee/lib/slf4j-api-1.7.21.jar \
      /opt/grouper/grouperWebapp/WEB-INF/lib/slf4j-jdk14-1.7.21.jar \
      /opt/grouper/grouperWebapp/WEB-INF/lib/slf4j-api-1.7.21.jar \
      /opt/grouper/grouperWebapp/WEB-INF/lib/slf4j-log4j12-1.7.21.jar
      COPY --chown=tomcat:tomcat container_files/lib/slf4j-jdk14-1.7.25.jar /opt/tomee/lib/
      COPY --chown=tomcat:tomcat container_files/lib/slf4j-api-1.7.25.jar /opt/tomee/lib/
      COPY container_files/lib/ /opt/grouper/grouperWebapp/WEB-INF/lib/
      (container_files/lib/ contains the 3 missing slf4j jars, v1.7.25)

      Andy Morgan(opens in new tab) 7 hours ago
      Reminder, Grouper 2.4 shipped with v1.7.25 jars

      Andy Morgan(opens in new tab) 7 hours ago
      But TomEE v7.0.7 ships with v1.7.21 slf4j jars

      Chris Hyzer(opens in new tab) 7 hours ago
      we had errors some some circumstances when the grouper jars conflicted with tomee jars

      Chris Hyzer(opens in new tab) 7 hours ago
      so we reverted the version

      Andy Morgan(opens in new tab) 7 hours ago
      yeah, I understand why you don't want to mix versions. That's why I replaced all instances of slf4j jars with the new version. I'm looking at slf4j diffs to see if I can find why it works in 1.7.25

      Chris Hyzer(opens in new tab) 7 hours ago
      looks like the key is tomee doesnt have slf4j-log4j12-1.7.21.jar

      Chris Hyzer(opens in new tab) 7 hours ago
      if you just remove that one file: /opt/tomee/lib/slf4j-log4j12-1.7.21.jar then does it all work as is? :slightly_smiling_face:

      Andy Morgan(opens in new tab) 7 hours ago
      Do you mean copy /opt/grouper/grouperWebapp/WEB-INF/lib/slf4j-log4j12-1.7.21.jar to /opt/tomee/lib/?

      Chris Hyzer(opens in new tab) 7 hours ago
      you remove a bunch of jars from tomee but dont add them all back, see?

      Chris Hyzer(opens in new tab) 7 hours ago
      oh, wait, nevermind, im getting confused

      Andy Morgan(opens in new tab) 7 hours ago
      /opt/tomee/lib/slf4j-log4j12-1.7.21.jar isn't present in the Grouper image

      Andy Morgan(opens in new tab) 7 hours ago
      3 jars in grouper, only 2 of them in tomee :slightly_smiling_face:

      Chris Hyzer(opens in new tab) 7 hours ago
      gotcha

      Chris Hyzer(opens in new tab) 7 hours ago
      you copy three jars back to grouper with #25 ver?

      Andy Morgan(opens in new tab) 7 hours ago
      I'll play around some more to see what I can learn

      Andy Morgan(opens in new tab) 7 hours ago
      Yep. Sorry if it isn't super clear from my Dockerfile. I'm replacing all instances of slf4j 1.7.21 jars with the same jar from 1.7.25

      Andy Morgan(opens in new tab) 7 hours ago
      my container_files/lib/ has various things in it, including all 3 slf4j jars

      Andy Morgan(opens in new tab) 7 hours ago
      1.7.23 is broken, 1.7.24 works (logs at DEBUG)

      Andy Morgan(opens in new tab) 7 hours ago
      I don't see anything obvious in the release notes for 1.7.24 that relates to this

      Chris Hyzer(opens in new tab) 7 hours ago
      if that works we can change grouper to do that :slightly_smiling_face: (put .25 everywhere)

      Andy Morgan(opens in new tab) 5 hours ago
      If you think that's okay, then it saves me the effort of rewriting our consumers to use Apache Commons Logging. That's not a huge burden, except that slf4j is better... :slightly_smiling_face:

      Andy Morgan(opens in new tab) 5 hours ago
      btw, it fixes the lack of DEBUG logging for pspng as well

      Andy Morgan(opens in new tab) 5 hours ago
      I wonder, is it necessary to replace the tomee jars? What role does tomee's lib directory have on deployed webapps?

      Andy Morgan(opens in new tab) 4 hours ago
      Eh, I just updated our Dockerfile to switch all occurrences to 1.7.25 jars and it works fine. I'll remove this workaround when upstream is fixed. Since PSPNG is affected, Grouper should be updated/fixed somehow - either use 1.7.25 jars to change PSPNG to use another log library. (edited)

      Andy Morgan(opens in new tab) 4 hours ago

      1. Replace slf4j with v1.7.25 to fix issue with DEBUG level logging
        RUN rm /opt/tomee/lib/slf4j-jdk14-1.7.21.jar /opt/tomee/lib/slf4j-api-1.7.21.jar /opt/grouper/grouperWebapp/WEB-INF/lib/slf4j-jdk14-1.7.21.jar /opt/grouper/grouperWebapp/WEB-INF/lib/slf4j-api-1.7.21.jar /opt/grouper/grouperWebapp/WEB-INF/lib/slf4j-log4j12-1.7.21.jar
        COPY --chown=tomcat:tomcat container_files/slf4j/slf4j-jdk14-1.7.25.jar /opt/tomee/lib/
        COPY --chown=tomcat:tomcat container_files/slf4j/slf4j-api-1.7.25.jar /opt/tomee/lib/
        COPY --chown=tomcat:tomcat container_files/slf4j/ /opt/grouper/grouperWebapp/WEB-INF/lib/

      Andy Morgan(opens in new tab) 4 hours ago
      container_files/slf4j/ contains the 3 jars that Grouper needs, btw

      Attachments

        Activity

          People

            chris.hyzer@at.internet2.edu Chris Hyzer (upenn.edu)
            chris.hyzer@at.internet2.edu Chris Hyzer (upenn.edu)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: