What are the best debugging tricks with Weld/CDI?

前端 未结 3 1809
梦谈多话
梦谈多话 2021-01-31 09:21

One of the beauties with Java EE 6 is the new dependency injection framework - CDI with the Weld reference implementation - which has prompted us to start migrating internally t

3条回答
  •  隐瞒了意图╮
    2021-01-31 10:08

    Weld uses Simple Logging for Java (sl4j). If you are using Tomcat, I suggest you add sl4j-jdk14-x.x.x.jar to application class path and append following lines to apache-tomcat-7.0.x/conf/logging.properties:

    org.jboss.weld.Bootstrap.level = FINEST 
    org.jboss.weld.Version.level = FINEST 
    org.jboss.weld.Utilities.level = FINEST 
    org.jboss.weld.Bean.level = FINEST 
    org.jboss.weld.Servlet.level = FINEST 
    org.jboss.weld.Reflection.level = FINEST 
    org.jboss.weld.JSF.level = FINEST 
    org.jboss.weld.Event.level = FINEST 
    org.jboss.weld.Conversation.level = FINEST 
    org.jboss.weld.Context.level = FINEST 
    org.jboss.weld.El.level = FINEST 
    org.jboss.weld.ClassLoading.level = FINEST
    

    This will generate lots of debug in console, so you`d better select something specific and comment out other lines.

    Other logging libraries (like log4j) can be configured using their respective config files and adding similar levels.

提交回复
热议问题