I have the following try and catch snippet.
try{
    ...
} catch(Exception e){
    System.out.print("error");
    e.printStackTrace();
}
error is displayed in admin console but I can't see the e.printStackTrace();
I have the following try and catch snippet.
try{
    ...
} catch(Exception e){
    System.out.print("error");
    e.printStackTrace();
}
error is displayed in admin console but I can't see the e.printStackTrace();
printStackTrace outputs to standard error, and System.out outputs to standard output. You can redirect the stack trace to standard output:
e.printStackTrace(new PrintWriter(System.out));
Then it will appear in the admin console.
Another approach is to convert the stack trace to a string and then you can log it or print it the same as the string you're already printing.
Here's how to get the stack track as a string: How to store printStackTrace into a string