2 Replies Latest reply on Apr 24, 2003 12:21 AM by sczadzeck

    How to disable the LogInterceptor?

    sczadzeck

      Noticed now that I have upgraded to JBoss 3.2.0 that when an exception occurs within a bean (one that I'm catching in my code) I get the following displayed on the console:

      14:02:02,750 ERROR [LogInterceptor] NoSuchEntityException:
      javax.ejb.NoSuchEntityException: Entity not found: primaryKey=8993
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.execute(JDBCLoad
      EntityCommand.java:215)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.execute(JDBCLoad
      EntityCommand.java:83)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadEntity(JDBCStoreM
      anager.java:632)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadEntity(JDBCStoreM
      anager.java:614)
      at org.jboss.ejb.plugins.CMPPersistenceManager.loadEntity(CMPPersistence
      Manager.java:386)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.load
      Entity(CachedConnectionInterceptor.java:353)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntityS
      ynchronizationInterceptor.java:232)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invo
      ke(CachedConnectionInterceptor.java:186)
      at org.jboss.ejb.plugins.EntityReentranceInterceptor.invoke(EntityReentr
      anceInterceptor.java:82)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstance
      Interceptor.java:174)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockIntercep
      tor.java:89)
      at org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreation
      Interceptor.java:53)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInte
      rceptor.java:84)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxIntercep
      torCMT.java:243)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:1
      04)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.
      java:117)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFacto
      ryFinderInterceptor.java:122)
      at org.jboss.ejb.EntityContainer.internalInvoke(EntityContainer.java:483
      )
      at org.jboss.ejb.Container.invoke(Container.java:674)
      at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalPro
      xyFactory.java:353)
      at org.jboss.ejb.plugins.local.EntityProxy.invoke(EntityProxy.java:38)...

      Does anyone know how to disable this? There are certain exceptions that I expect to encountered and handle in my code...I really hope I don't have to receive a full stack trace when they occur.

      Thanks for the help in advance.
      Scott

        • 1. Re: How to disable the LogInterceptor?

          NoSuchEntity is a runtime exception so we
          log it.

          It doesn't look very easy to subclass
          the log interceptor.

          You could replace it with a version that
          doesn't log this message.
          It is configured in standardjboss.xml

          If it bothers you that much, post a patch
          that makes it easy to subclass it.

          e.g.
          else if (e instanceof NoSuchException)
          {
          handleNoSuchEntityException(e, invocation, local);
          }

          Don't remove it, it also provides the j2ee spec
          exception handling.

          Another approach would be to set the logging
          level to FATAL for this class, but then you would
          lose all the logging provided by this class.

          Regards,
          Adrian

          • 2. Re: How to disable the LogInterceptor?
            sczadzeck

            I think the best way to solve this problem would be if there was a way to determine if my reference to the entity has become invalid due to the fact of its removal by another process. Anyone know of an efficient way to do this (besides reloading the bean)?

            Thanks,
            Scott