in reply to Output of STDERR - Probably an easy one
You can use Log::Log4perl. It is very powerful module for logging
You can log to STDOUT or to file or to both of them simultaneously. It's really handy, must have tool.