1 2 Previous Next 17 Replies Latest reply on Jun 20, 2008 3:06 PM by wrzep Go to original post
      • 15. Re: Seam Component Out of Box, Guice, JobssMC
        kariem

        Kamil,


        Pawel was referring to the solution provided by the seam logger, which I can also recommend. You can find more information in the seam logging documentation.


        This at least solves the problem with string concatenation, and if you want to prevent the lazy execution in the persistence layer, you might use EL. Example:


        log.debug("user=#1, roles=#2", user, user.getRoles());



        If you can use EL:


        log.debug("user=#{user}, roles=#{user.roles}");



        But as I can see from your previous comments, you don't really like to use EL in Java. I also don't use EL in logging, but the seam logging capabilities are really great, and I sometimes even use the in simple pojos. It's just much easier to read.


        By the way, you can also use logging in all components that extend org.jboss.seam.framework.Controller which provides delegates to a class level org.jboss.seam.log.Log.

        • 16. Re: Seam Component Out of Box, Guice, JobssMC
          skajotde

          Kariem Hussein wrote on May 23, 2008 15:20:


          Kamil,

          Pawel was referring to the solution provided by the seam logger, which I can also recommend. You can find more information in the seam logging documentation.


          Yes, I also aware of verbose code using log.isDebugEnabled(). In our system logging is making code more verbose (logging is mandatory). I'm thinking about using logging with AOP (most logging instruction are simply imformation about parameters from function) Result is short functions with annotations. It would be like:


          Logger(Debug)
          void smallFunction(int a, int b)




          This at least solves the problem with string concatenation, and if you want to prevent the lazy execution in the persistence layer, you might use EL. Example:

          log.debug("user=#1, roles=#2", user, user.getRoles());



          If you can use EL:

          log.debug("user=#{user}, roles=#{user.roles}");



          But as I can see from your previous comments, you don't really like to use EL in Java. I also don't use EL in logging, but the seam logging capabilities are really great, and I sometimes even use the in simple pojos. It's just much easier to read.


          Yes I'm not big fan of intesively using dynamic values when they aren't need. Refactoring and searching occurences of methods
          /atributes fails. (IMHO few occurences of EL are ok but not more than in 30% code)


          At now would be helpfull some inner class and syntactic sugar like CICE. Example


          log.debug("user#1 has roles: #2", LazyArguments { user, user.getRoles() })



          And maybe in future some metaprogramming features will be available. Java is using intensively XML, SQL and String operations but there is not some STATIC typed - Language Builtin  - Type Template supported by compiler.  I would need executing some user code on compilation phase builtin in language. Compilation and runtime phases are too far.


          Sample using type Template ($user and $user#getRoles() are static typed, refactorable, lazy evaluated):


          log.debug(Template$$user: $user has roles $user#getRoles$$)




          By the way, you can also use logging in all components that extend org.jboss.seam.framework.Controller which provides delegates to a class level org.jboss.seam.log.Log.


          I don't know what you mean ;)


          -- Kamil

          • 17. Re: Seam Component Out of Box, Guice, JobssMC
            wrzep

            FYI, I've just blogged about Seam and Guice integration. I've also submitted it as a patch, so you can vote for it ;)


            Thanks for your feedback, Kamil!


            Pawel

            1 2 Previous Next