diff --git a/src/main/java/org/nebula/contrib/ngbatis/proxy/MapperProxy.java b/src/main/java/org/nebula/contrib/ngbatis/proxy/MapperProxy.java index cc9a148b..404e5b69 100644 --- a/src/main/java/org/nebula/contrib/ngbatis/proxy/MapperProxy.java +++ b/src/main/java/org/nebula/contrib/ngbatis/proxy/MapperProxy.java @@ -210,14 +210,16 @@ public static ResultSet executeWithParameter(ClassModel cm, MethodModel mm, Stri ResultSet result = null; String proxyClass = null; String proxyMethod = null; + String localSessionSpace = null; try { + localSession = ENV.getDispatcher().poll(); if (log.isDebugEnabled()) { StackTraceElement stackTraceElement = Thread.currentThread().getStackTrace()[6]; proxyClass = stackTraceElement.getClassName(); proxyMethod = stackTraceElement.getMethodName(); + localSessionSpace = localSession.getCurrentSpace(); } - localSession = ENV.getDispatcher().poll(); String currentSpace = getSpace(cm, mm); gql = qlWithSpace(localSession, gql, currentSpace); session = localSession.getSession(); @@ -231,8 +233,14 @@ public static ResultSet executeWithParameter(ClassModel cm, MethodModel mm, Stri } catch (Exception e) { throw new QueryException("数据查询失败:" + e.getMessage(), e); } finally { - log.debug("\n\t- proxyMethod: {}#{} \n\t- nGql:{} \n\t - params: {}\n\t - result:{}", - proxyClass, proxyMethod, gql, params, result); + if (log.isDebugEnabled()) { + log.debug("\n\t- proxyMethod: {}#{}" + + "\n\t- session space: {}" + + "\n\t- nGql:{}" + + "\n\t- params: {}" + + "\n\t- result:{}", + proxyClass, proxyMethod, localSessionSpace, gql, params, result); + } if (localSession != null) { ENV.getDispatcher().offer(localSession); }