Get a stack trace from packaging process

What would be the most straightforward way of getting a stack trace for packaging errors?