refactoring to make log4cxx an optional dependency

@gerkey @tfoote @wjwwood Please review.

Especially any feedback on the interface for custom backends would be appreciated (see https://github.com/ros/ros_comm/compare/log4cxx?expand=1#diff-1e993bcf45a700893f4d675ec053f1aaR57).