8 Replies Latest reply on Sep 30, 2014 7:06 AM by mkouba

    Weld logging

    emilyj

      I am trying to use Weld but the its logging depends on many other third party libraries. Besides, the jboss-logging-processor.jar and jboss-logmanager-1.0.4.jar are not under apache license while the other weld jars are under apache license. How can I use weld without bring down the non-apache licensed jars?

      Thanks

      Emily

        • 1. Re: Weld logging
          mkouba

          Hi Emily,

          jboss-logging itself is ASL2. jboss-logmanager is not necessary, it's just one of the supported logging providers (others include log4j, slf4j, jul). Simply put a more suitable provider on the classpath. jboss-logging-processor shouldn't be necessary either - it contains an annotation processor which generates classes used in the runtime (see also JBoss Logging Tooling).  Anyway, it's LGPL, so it should be safe to use in most OSS or proprietary applications.

          • 2. Re: Weld logging
            emilyj

            Thank you Martin for your reply. It would be ideal for me if I don't reply on jboss-logmanager. However, without it, I cannot resolve the class org.jboss.weld.logging.BeanLogger as it imports org.jboss.logging.annotation, which defined in the jboss-logmanager. How can I swap it out? I have slf4j in my runtime. It will be great if I can config weld logging to use slf4j but some logging classes seem to import log4j packages. I had to pull in log4j as well, which is quite sticky. Unfortunately the JBoss Logging Tooling link did not give a pointer about how to resolve this. Any more suggestions will be very much appreciated!

            • 3. Re: Weld logging
              mkouba

              What version of Weld and jboss-logging do you use? org.jboss.logging.annotations package was originally part of the  jboss-logging jar and now it's included in jboss-logging-processor. jboss-logmanager is definitely not required. Also Weld classes don't import log4j packages. Anyway, if you want to skip the logging provider detection and force the use of slf4j use the following system property: -Dorg.jboss.logging.provider=slf4j (see also http://grepcode.com/file/repo1.maven.org/maven2/org.jboss.logging/jboss-logging/3.1.4.GA/org/jboss/logging/LoggerProvide…)

              • 4. Re: Weld logging
                emilyj

                Thanks Martin for your quick reply! I am using weld 2.2.5.final. In the weld core impl jar (http://mvnrepository.com/artifact/org.jboss.weld/weld-core-impl/2.2.5.Final), it lists the dependency on jboss-logmanager. It looks like the logging version is 3.1.3. I am using the jars in an OSGi environment, so I need to provide all the dependencies so that it can be resolved. As you can see, the weld core impl depends on both slf4j and log4j. Therefore, I had to supply both. Did I miss anything?

                • 5. Re: Weld logging
                  mkouba

                  Yes, but it has the test dependency scope. Similarly jboss-logging-processor has the provided scope. See also http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html. I cannot see log4j or slf4j on the weld-core-impl dependency list.

                  1 of 1 people found this helpful
                  • 6. Re: Weld logging
                    mkouba

                    Furthermore, there's a Weld runtime packaged as an OSGi bundle available: http://search.maven.org/#artifactdetails|org.jboss.weld|weld-osgi-bundle|2.2.5.Final|jar

                    • 7. Re: Weld logging
                      emilyj

                      Thank you Martin! You were right that logmanager is not required. My dependencies has certainly shrinked after removing it and its dependencies. As for the Weld OSGi bundle, is it a aggregation of all modules except java se bit?

                      • 8. Re: Weld logging
                        mkouba

                        Emily Jiang napsal(a):

                         

                        Thank you Martin! You were right that logmanager is not required. My dependencies has certainly shrinked after removing it and its dependencies. As for the Weld OSGi bundle, is it a aggregation of all modules except java se bit?

                        It contains all Weld core parts (API, SPI, core implementation, ...) and JBoss Class File Writer (bytecode manipulation library).