in reply to Log STDERR

Instead of writing your own logger, It might be a good idea to check out Log::Log4perl. It is much more flexible and has far more features than anything you are likely to write yourself, and by using it, you save the need to debug and maintain a component in your script.