Redirect warnings to the logging system on python versions >= 2.6  Refs #3135.