Skip to content

Commit

Permalink
Merge pull request #79 from CorvusYe/master
Browse files Browse the repository at this point in the history
enhanced: #64 [debug log] print current space in session before switch
  • Loading branch information
CorvusYe authored Nov 7, 2022
2 parents 4a3c492 + ff3d5ee commit 40170d4
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/main/java/org/nebula/contrib/ngbatis/proxy/MapperProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
}
Expand Down

0 comments on commit 40170d4

Please sign in to comment.