10 Replies Latest reply: Sep 17, 2011 4:34 PM by Jerome R. RSS

Weld SE and slf4j

Pieter Martin Novice

Hi,


I am trying to use log4j in my weld SE application.


However slf4j-simple is included in the weld-se distribution via the maven-shade-plugin.


This means that when I include slf4j-log4j12 in my app it gets ignored.


When I exclude slf4j-simple in the pom for the maven-shade-plugin all is ok again.


weld-se/pom.xml ...


         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <executions>
               <execution>
                  <phase>package</phase>
                  <goals>
                     <goal>shade</goal>
                  </goals>
                  <configuration>
                  </configuration>
               </execution>
            </executions>
         <configuration>
              <artifactSet>
                <excludes>
                  <exclude>org.slf4j:slf4j-simple</exclude>
                </excludes>
              </artifactSet>
            </configuration>
         </plugin>





Is this a bug of sorts or do I need to configure the logging in some other way?


Thanks
Pieter

  • 1. Re: Weld SE and slf4j
    Koichi Kobayashi Newbie

    Hi,


    Because WELDX-51 was re-opened, it may be fixed.

  • 2. Re: Weld SE and slf4j
    Peter Royle Newbie

    Now it's fixed :)

  • 3. Re: Weld SE and slf4j
    Koichi Kobayashi Newbie

    Thanks!

  • 4. Re: Weld SE and slf4j
    Christian Bauer Master

    This is not fixed in 1.1.1-Final. Weld SE is unusable in its current packaging, I don't want your slfuckjava-simple.

  • 5. Re: Weld SE and slf4j
    Christian Bauer Master

    If you want to use Weld in Java SE, don't use this Maven dependency:


            <dependency>
                <groupId>org.jboss.weld.se</groupId>
                <artifactId>weld-se</artifactId>
                <version>1.1.1.Final</version>
            </dependency>
    
    



    Use this instead:


            <dependency>
                <groupId>org.jboss.weld.se</groupId>
                <artifactId>weld-se-core</artifactId>
                <version>1.1.1.Final</version>
            </dependency>
    
            <dependency>
                <groupId>org.jboss.weld</groupId>
                <artifactId>weld-core</artifactId>
                <version>1.1.1.Final</version>
            </dependency>
    
            <dependency>
                <groupId>org.javassist</groupId>
                <artifactId>javassist</artifactId>
                <version>3.14.0-GA</version>
            </dependency>
    
            <!-- Here you pick what logging system you really want to use -->
            <dependency>
                <groupId>org.slf4j</groupId>
                <!-- Oh, I have an idea! There is one in every JVM classpath! -->
                <artifactId>slf4j-jdk14</artifactId>
                <!-- Has to be >= 1.5.5 because SLF4J is garbage -->
                <version>1.5.10</version>
            </dependency>
    
    

  • 7. Re: Weld SE and slf4j
    Ondrej Zizka Master

    Sorry if I am missing something obvious - but
    why there's no artifact like weld-se-core with dependency on weld-core and javaassist?

  • 8. Re: Weld SE and slf4j
    Ondrej Zizka Master

    Now I see that weld-se-core actually depends on weld-core which depends on javaassist.
    So only weld-se-core is needed - just tried with my SE app.

  • 9. Re: Weld SE and slf4j
    Ondrej Zizka Master

    And, for the next time, I'd suggest to name it weld-se-bundle to make it clear right from artifact name. WDYT.

  • 10. Re: Weld SE and slf4j
    Jerome R. Newbie

    In my case with slf4j 1.6.2 and log4j, weld-se works fine, only with this dependencies :


                   <dependency>
                            <groupId>org.jboss.weld.se</groupId>
                            <artifactId>weld-se-core</artifactId>
                            <version>1.1.1.Final</version>
                    </dependency>
    
                    <dependency>
                            <groupId>org.jboss.weld</groupId>
                            <artifactId>weld-core</artifactId>
                            <version>1.1.1.Final</version>
                            <exclusions>
                                    <exclusion>
                                            <artifactId>slf4j-ext</artifactId>
                                            <groupId>org.slf4j</groupId>
                                    </exclusion>
                            </exclusions>
                    </dependency>
    
                    <dependency>
                            <groupId>org.slf4j</groupId>
                            <artifactId>slf4j-log4j12</artifactId>
                            <version>1.6.2</version>
                    </dependency>
    
                    <dependency>
                            <groupId>org.slf4j</groupId>
                            <artifactId>slf4j-ext</artifactId>
                            <version>1.6.2</version>
                    </dependency>