1 2 Previous Next 21 Replies Latest reply on Feb 8, 2007 8:25 PM by raghinii Go to original post
      • 15. Re: Issues moving from Seam 1.1.0 to Seam 1.1.5
        gavin.king

        I agree that under no circumstances should the log throw an exception back to application code. (Even though this was definitely a case of wrong usage...)

        • 16. Re: Issues moving from Seam 1.1.0 to Seam 1.1.5

           

          definitely a case of wrong usage
          ?

          Last summer at JBoss world, when you first presented this, I was under the impression that you were offering @Logger as an annotation based replacement for the usual commons logging stuff:

          
          private Log log = LogFactory.getLog(MyClass.class);
          
          


          I guess I misunderstood or misheard something about how @Logger should be used. Anyway, as I said, I can revert to the 'old' way with commons logging. I didn't realize that I would be forced to change the way I write my logging statements and that I would be wrong if I didn't (when using @Logger. Lesson learned....

          Thanks

          • 17. Re: Issues moving from Seam 1.1.0 to Seam 1.1.5
            gavin.king

            The point of this is to get rid of crap like:

            private static final Log log = LogFactory.getLog(Customer.class);


            if ( log.isDebugEnabled() ) {
             log.debug("deleting customer " + customer.getName() + " in region " + customer.getRegion());
            }


            And let you use:

            @Logger private static final Log log;


            log.debug("deleting customer #{customer.name} in region #{customer.region}");


            I don't know about you, but I think thats a *significant* improvement in readability.

            I don't think we did a bad job on this.

            • 18. Re: Issues moving from Seam 1.1.0 to Seam 1.1.5
              smokingapipe

              In my experience, I end up deleting most of my logging statements as I finish pieces of code. They help me a lot when I'm trying to get the basic code going. I might put 5 log statements in a simple method sometimes, if I really can't figure out why it's not working. After I get it fixed I then take those out; whatever software bug I had in there won't be coming back. So I never use the if(logLevel == DEBUG) idiom. And I always use the java.util.logging classes, because I know they will be there, no matter what is or is not on the classpath, or no matter what kind of classloader problems might be happening.

              • 19. Re: Issues moving from Seam 1.1.0 to Seam 1.1.5

                 

                "gavin.king@jboss.com" wrote:
                I agree that under no circumstances should the log throw an exception back to application code. (Even though this was definitely a case of wrong usage...)


                Just don't call it with more than 10 arguments then. :)



                • 20. Re: Issues moving from Seam 1.1.0 to Seam 1.1.5
                  gavin.king

                  LOL

                  • 21. Re: Issues moving from Seam 1.1.0 to Seam 1.1.5
                    raghinii

                    heh. i'm surprised at the hostility towards this log. I really like not having to add the isDebugEnabled() guard around my debug statements to save the string building.

                    beyond that, the formatting comes for free. Before i would just use String.format in my normal log4j logger messages.

                    As far as logging during development, i usually just attach a debugger and do it that way. I find it to be a much faster method most of the time. I only wish i could do the same through the pages...


                    1 2 Previous Next