代码之家  ›  专栏  ›  技术社区  ›  Matteo Baldi user1919359

jboss eap 6.4 with hibernate-在日志文件中隐藏特定的Oracle异常

  •  0
  • Matteo Baldi user1919359  · 技术社区  · 6 年前

    玩弄 PersistenceException -gt; SQLException -gt; getErrorCode() ,我在日志中隐藏了一个特定的Oracle错误。问题是,在我的 server.log 我还是发现了这样的行:

    WARN  25 Sep 2018 12:14:47,121 - id  - org.hibernate.engine.jdbc.spi.SqlExceptionHelper - ms 5829302 SQL Error: 13333, SQLState: 72000
    ERROR 25 Sep 2018 12:14:47,121 - id  - org.hibernate.engine.jdbc.spi.SqlExceptionHelper - ms 5829302 ORA-13333: invalid LRS measure
    ORA-06512: at "MDSYS.SDO_LRS", line 3149
    ORA-06512: at line 1
    

    我没有特别记录。

    这是我的代码:

    try {
     try {
      //business stuff
     } catch (PersistenceException persEx) {
      if (persEx.getCause() != null && persEx.getCause() instanceof GenericJDBCException) {
       GenericJDBCException jdbcEx = (GenericJDBCException) persEx.getCause();
       SQLException sqlEx = (SQLException) jdbcEx.getCause();
       if (sqlEx.getErrorCode() == 13333) {
        //handling ORA-13333: invalid LRS measure as an info
        log.info("Possible invalid LRS measure");
       } else {
        throw persEx; // do not swallow unhandled exceptions
       }
      } else {
       throw persEx; // do not swallow unhandled exceptions
      }
     } catch (Exception e) {
      log.error("Other exception:" + e.getMessage());
     }
    } catch (Exception e) {
     log.error("Exception to log:" + e.getMessage());
    }
    
    1 回复  |  直到 6 年前
        1
  •  1
  •   Matteo Baldi user1919359    6 年前

    通过向 JBoss 日志处理程序,在这种情况下

    <filter-spec value="all(not(match(&quot;ORA-13333&quot;)), not(match(&quot;SQL Error: 13333&quot;)))"/>
    

    我希望它对其他人有用。