When my program prints stack trace in NetBeans IDE, for example this:
Exception in thread "main" java.lang.RuntimeException: Not implemented yet
at App.App.main(App.java:202)
The "App.java:202" part is a link. When I click it, it directs me to the file and line.
I would like to do this in my own logs. Just printing it doesn't work for me.
My not functional log line example:
2015/06/01 10:27:19.197 (DbConnection.java:119) ExecuteQuery ....
Solution:
StackTraceElement s = Thread.currentThread().getStackTrace()[1];
System.out.printf("%s.%s(%s:%s)%n", s.getClassName(), s.getMethodName(),s.getFileName(), s.getLineNumber());
New problem:
If I print this:
App.App.RunTests(App.java:128) th_id:1,main WARN null Database.DbValuesCache.run(DbValuesCache.java:153) ....
.. only the first link works.
What now?