Skip to content

Instantly share code, notes, and snippets.

@tnhu
Created July 13, 2016 22:41
Show Gist options
  • Save tnhu/eaa01bf5e5d96d24e41e08f91f471db2 to your computer and use it in GitHub Desktop.
Save tnhu/eaa01bf5e5d96d24e41e08f91f471db2 to your computer and use it in GitHub Desktop.
Dump Java stack trace without throwing an exception
import org.apache.commons.lang3.exception.ExceptionUtils;
import play.Logger;
String stackTrace = ExceptionUtils.getStackTrace(new Exception()));
// Log warning with stack trace for a deprecated method
Logger.warn("Method is deprecated: " + stackTrace);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment