2 Replies Latest reply on Apr 3, 2009 7:58 PM by Bob Thule

    Custom LogProvider

    Bob Thule Newbie

      How do I use a custom LogProvider?  If I create my own class, say Slf4jLogProvider extending LogProvider, then how do I use it?


      Looking in org.jboss.seam.log.Logging, I see:



         static LogProvider getLogProvider(String category, boolean wrapped)
         {
            return isLog4JAvailable ? 
                     new Log4JProvider(category, wrapped) : 
                     new JDKProvider(category, wrapped);
         }
      



      From this, it seems that I might not be able to use my own LogProvider.  Can someone please verify that, or please explain how it is possible?


      Thanks!
      Bob

        • 1. Re: Custom LogProvider
          Elias Ross Master

          I took a look and you're right. Not sure what you could do here. Maybe use @In for injecting your own log component?

          • 2. Re: Custom LogProvider
            Bob Thule Newbie

            Yeah, I thought about that too, but using @In doesn't do the extra work that the @Logging annotation does to set the logging implentations' category with the containing class's Class name.


            Without that extra work, you would have to pass the category in every call to the custom logging implementation.  ie:



            class TestAction {
                @In MyLog log;
                ...
                public void test() {
                    log.debug(TestAction.class, "It would be a bummer to have to pass the TestAction.class in on every call!");
                }
            }



            vs


            class TestAction {
                @Logging Log log;
                ...
                public void test() {
                    log.debug("This is more like it.  But how do I use this with my own LoggingProvider");
                }
            }