Log a stacktrace if available