in reply to Re^2: "Accessors (don't always) break encapsulation"
in thread "Accessors break encapsulation"?

I encountered almost exactly this situation. Here was my solution to keep code simple and avoid the excessive hit.
$obj->log_on_error{sub {Dumper($some_very_large_structure)});
The standard logging modules may not provide this functionality though.