5 Replies Latest reply on Feb 28, 2006 12:57 PM by Scott Stark

    Dependencies on jboss-commons and Log4j

    Clebert Suconic Master

      http://jira.jboss.org/jira/browse/JBSER-41


      I'm planning to completely remove any third-library dependency on JBoss Serialization.

      Dependencies are already minimal, and I only need jboss-commons to log4j.

      I would like to require only one jar to use jboss-serialization, and if someone outside of jboss want to use it, they won't need to import jboss-commons and log4j for such thing.

      As explained on JBSER-41, I would create a Logger wrapper using System Properties on its configuration.[/url]

        • 1. Re: Dependencies on jboss-commons and Log4j
          Clebert Suconic Master

          Just a FYI, that dependency is now solved.

          • 2. Re: Dependencies on jboss-commons and Log4j
            Scott Stark Master

            How, using yet another logging wrapper? If so, another rant is about to errupt.

            • 3. Re: Dependencies on jboss-commons and Log4j
              Clebert Suconic Master

              > How, using yet another logging wrapper? If so, another rant is about to errupt.

              I need to support some logging within JBossSerialization, as a way I (or future contributors) could debug it.

              If you define org.jboss.serial.LogLevel=5 it will enable tracing on JBossSerialization. There is a class doing that parsing:

              org.jboss.serial.util.Logger

              The wrapper is pretty small, is more an utility class.

              I didn't like the solution itself. Still looking for a better way to do it:

              The reason that I wanted to avoid using jboss-common and log4j was just to make easier using JbossSerialization outside of JBoss. (just add a JAR and import the correct package)

              • 4. Re: Dependencies on jboss-commons and Log4j
                Clebert Suconic Master

                Well... as I know you (and everybody else) is going to complain about it, I'm going to change it. lol

                I will try to keep using log4j and jboss-commons, but testing for classes availability. (like, if not available, just disabling log).

                I will probably need to work with Object on the logger, and create a small parser just to do the type cast.



                public class SomeClas
                {
                public static Object logger;
                public static boolean isLog;

                static
                {
                // some initialization on the logger
                }


                public void someMethod()
                {
                if (isLog) // just to no test for the type if don't need to
                {
                LoggerWrapper.log(logger,message);
                }
                }
                }


                The LoggerWrapper will deal with conversions, using reflection so I could have jboss-serialization.jar without having log4j.jar and jboss-commons.jar on the classpath.

                • 5. Re: Dependencies on jboss-commons and Log4j
                  Scott Stark Master

                  The two acceptable logging frameworks are commons-logging and the org.jboss.logging in the jboss common module. One or the other is what you should depend on. So either there is no logging (bad), or you have a dependency on a logging framework.

                  In terms of the jboss common jar, we have stated a number of times that its too big and needs to be broken up. Someone just needs to do it.