I have an application which redirect `System.out` for example;

```
  System.setOut(new PrintStream(System.out){
    @Override
    public void print(String string)
    {
      //TODO: find out who sent the print before processing string
    }
  });

```

I want to be able to determine which class is sending the call to print to stdout? I think this is not possible, but cannot fully conclude unless `SO` say so.
['https://Stackoverflow.com/questions/12195583', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/340390/']
Get the [stacktrace](http://docs.oracle.com/javase/7/docs/api/java/lang/Throwable.html#getStackTrace%28%29) and find the class name from the currect index.

```
StackTraceElement[] trace = Thread.currentThread().getStackTrace();

```
You could throw an exception, and examine the stack trace. Obviously not great for production code.