MT#5879 Use log4perl for logging.

And added option allow_terminated to allow to generate invoice
for customers with terminated contracts.