Skip to content

Commit

Permalink
Raise log level for exceptions from EntityManager close call
Browse files Browse the repository at this point in the history
Closes gh-24501
  • Loading branch information
jhoeller committed Feb 12, 2020
1 parent b889700 commit e0319b1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -505,7 +505,7 @@ protected void closeConnection(Connection con) {
logger.debug("Ignoring Connection state exception - assuming already closed: " + ex);
}
catch (Throwable ex) {
logger.debug("Could not close shared JMS Connection", ex);
logger.warn("Could not close shared JMS Connection", ex);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -170,11 +170,8 @@ public static void closeSession(@Nullable Session session) {
try {
session.close();
}
catch (HibernateException ex) {
logger.debug("Could not close Hibernate Session", ex);
}
catch (Throwable ex) {
logger.debug("Unexpected exception on closing Hibernate Session", ex);
logger.error("Failed to release Hibernate Session", ex);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -427,11 +427,8 @@ public static void closeEntityManager(@Nullable EntityManager em) {
em.close();
}
}
catch (PersistenceException ex) {
logger.debug("Could not close JPA EntityManager", ex);
}
catch (Throwable ex) {
logger.debug("Unexpected exception on closing JPA EntityManager", ex);
logger.error("Failed to release JPA EntityManager", ex);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -604,9 +604,9 @@ protected void doCleanupAfterCompletion(Object transaction) {
getJpaDialect().releaseJdbcConnection(conHandle,
txObject.getEntityManagerHolder().getEntityManager());
}
catch (Exception ex) {
catch (Throwable ex) {
// Just log it, to keep a transaction-related exception.
logger.error("Could not close JDBC connection after transaction", ex);
logger.error("Failed to release JDBC connection after transaction", ex);
}
}
}
Expand Down

0 comments on commit e0319b1

Please sign in to comment.