Instead of printing use the logging framework.