diff options
author | Florian Reimair <florian.reimair@iaik.tugraz.at> | 2015-03-23 13:41:33 +0100 |
---|---|---|
committer | Florian Reimair <florian.reimair@iaik.tugraz.at> | 2015-03-24 13:59:31 +0100 |
commit | 1bb5a7e0db70fb95343436155571f2037372c352 (patch) | |
tree | a1a11095811d8fbe0b898d888861115eb84b9c3e /common/src | |
parent | 8eaab8fd3ec73e4ecbf3c24e9061a83419f6395e (diff) | |
download | moa-id-spss-1bb5a7e0db70fb95343436155571f2037372c352.tar.gz moa-id-spss-1bb5a7e0db70fb95343436155571f2037372c352.tar.bz2 moa-id-spss-1bb5a7e0db70fb95343436155571f2037372c352.zip |
made logging system more robust
Diffstat (limited to 'common/src')
-rw-r--r-- | common/src/main/java/at/gv/egovernment/moa/logging/Logger.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/common/src/main/java/at/gv/egovernment/moa/logging/Logger.java b/common/src/main/java/at/gv/egovernment/moa/logging/Logger.java index 6999656ab..265ad026d 100644 --- a/common/src/main/java/at/gv/egovernment/moa/logging/Logger.java +++ b/common/src/main/java/at/gv/egovernment/moa/logging/Logger.java @@ -58,7 +58,14 @@ public class Logger { * @return the logger */ private static synchronized org.slf4j.Logger getLogger() { - String className = Thread.currentThread().getStackTrace()[3].getClassName(); + StackTraceElement[] stacktrace = Thread.currentThread().getStackTrace(); + + int i; + for(i = 2; i < stacktrace.length; i++) + if(!stacktrace[i].getClassName().equals(Logger.class.getName())) + break; + + String className = stacktrace[i].getClassName(); org.slf4j.Logger logger = instances.get(className); if (logger != null) { |