8 Replies Latest reply on Mar 5, 2008 12:45 AM by shane.bryzak

    Removing the NotLoggedInException

      This is something that has been bugging for a while now.


      Whenever I am on a page that requires the user to be logged in, Seam logs a NotLoggedInException as ERROR (and shows the stack trace). In my sense, this should be logged as WARN or INFO.


      I do not want to see any exception in my
      log files or console. In fact, an application that works perfectly should not have any Exception (e.g. in case of an Exception, someone should be alerted)


      Does anyone know how to prevent Seam from logging this exception as error? (I would like to to be logged as warning
      or info).

        • 1. Re: Removing the NotLoggedInException
          nickarls

          Do you have a


          
          <exception class="org.jboss.seam.security.NotLoggedInException">
          
            ...
          
          </exception>
          
          



          in pages.xml?

          • 2. Re: Removing the NotLoggedInException
            shane.bryzak

            If you want to change the log level:



                <exception class="org.jboss.seam.security.NotLoggedInException" logLevel="info">
            
                </exception>




            If you want to suppress all logging of the exception:



                <exception class="org.jboss.seam.security.NotLoggedInException" log="false">
            
                </exception>


            • 3. Re: Removing the NotLoggedInException

              I do have that in pages.xml


              However I tried to use logLevel and log: none of them work.


              Also Eclipse shows me an error when I try to add logLevel or log in pages.xml


              I use Seam-2.0.1.GA.


              Is this a new feature in 2.1.0.A1 ?

              • 4. Re: Removing the NotLoggedInException
                keithnaas

                Mounir,


                Try severity.  Looking at the source where this is initialized in Exceptions.java that seems to be the attribute name.


                <exception class="org.jboss.seam.security.NotLoggedInException" severity="info">
                
                </exception>
                

                • 5. Re: Removing the NotLoggedInException

                  I tried to add the severity=info as you mentioned (at the tag exception) but it did not work and Eclipse showed me an error.


                  The only place where you can add the attribute severity is under
                  the message tag under redirect (which is under exception).



                  
                  <exception class=org.jboss.seam.security.NotLoggedInException >
                  <redirect view-id=/login.xhtml>
                  <message severity=INFO> ... </message> 
                  </redirect>
                  </exception>
                  



                  However, this did not work also.


                  I checked the notes for the 2.0.1.A1 version and it seems
                  like that this may this is a bug that may get fixed soon:


                  I tried to add the severity="info" as you mentioned (at the tag exception) but it did not work and Eclipse showed me an error.


                  The only place where you can add the attribute severity is at the message tag under redirect (which is under exception).
                  I don't know what this does and I tried INFO, WARN, ERROR but did not notice any changes in there, neither on the UI part.



                  I found the following on the notes about the 2.0.A1 version and this bug may get fixed soon:


                  * [JBSEAM-1021] - Don't log exceptions if they are handled in pages.xml




                  Any idea?

                  • 6. Re: Removing the NotLoggedInException
                    keithnaas

                    Mounir,


                    Another possibility to get it to go away is to circumvent the NotLoggedInException.


                    Try using the login-required attribute on the page urls that need protected.  I believe that this doesn't cause a NotLoggedInExceptoin to be thrown.  Instead it redirects to the pages login-view-id.


                    <pages login-view-id="/unprotected/login.jsf">
                        <page view-id="/protected/*" login-required="true" />
                    </pages>
                    



                    Keith

                    • 7. Re: Removing the NotLoggedInException

                      Hey Keith,


                      That did the trick!


                      I just added the login-view-id
                      attribute and it does not log any NotLoggedInException anymore.


                      Thanks a lot!


                      Mounir

                      • 8. Re: Removing the NotLoggedInException
                        shane.bryzak

                        Mounir Bakkali wrote on Mar 04, 2008 06:52 PM:


                        I do have that in pages.xml

                        However I tried to use logLevel and log: none of them work.

                        Also Eclipse shows me an error when I try to add logLevel or log in pages.xml

                        I use Seam-2.0.1.GA.

                        Is this a new feature in 2.1.0.A1 ?



                        Apologies, it is a 2.1.0 feature.  This will work in the latest SVN version of Seam.