2 Replies Latest reply on Mar 22, 2012 4:23 PM by Martin Dames

    How to log with Weld and AS 7.1

    Martin Dames Newbie

      Hi there,


      Im wondering how I can use logging in my JEE6 WebApp with JBoss AS 7.1.1.

      As I know I should use slf4j, which belongs to AS 7. Then I can @Inject the appropriate Logger instance in my beans as describes in



      But this does not work. I have added to my pom.xml:


                 <!-- Java EE 6 doesn't require web.xml, Maven needs to catch
                    up! -->



      Then I do not have slf4j jar in my eclipse project build path. So I can not use it. If I add a normal dependecy to slf4j in my pom.xml, then the application

      does not start anymore and JBoss Tools are saying "No bean is eligible for injection to the injection point [JSR-299 §5.2.1]".


      Well.... I am pretty confused about logging in JEE apps... I just want to inject a logging instance, log with debug and info, use templates... everything like Seam2 logging does...


      How is this possible?


      Thank you.

        • 1. Re: How to log with Weld and AS 7.1
          James Perkins Master

          Do you also have the dependency set in the dependency section of your POM? You might want to try that out just to see if the error goes away.

          • 2. Re: How to log with Weld and AS 7.1
            Martin Dames Newbie

            Thank you for your answer, but I found JBoss Soldier (from Seam 3) and its offers everything I need.


            Here are some tips:

            1. Add dependency to pom for maven (see http://seamframework.org/Seam3/Solder)

            2. Configure logging standalone.xml

            2a. add your own logger category



            <logger category="de.mdames">

                 <level name="TRACE"/>




            2b. set console (or file-) handler level to TRACE

            2c. keep root logger level at INFO, otherwise JBoss AS will log too much


            3. Inject Logger


            import org.jboss.solder.logging.Logger;


            @Inject private Logger log;



            4. Use logger instance


            log.debugv("Trying to authenticate {0}", username);



            5. Restart JBoss AS


            Hope someone find this useful.