Getting MooseX::Traits and Log::Log4perl to play nice

[email protected] ("Dan Harbin")
Newsgroups perl.moose
Message-ID <[email protected]>
Moose-people,

I have a large system built with Moose objects and roles that is logged with
Log::Log4perl.  Moose meets my needs well, and the functionality of
MooseX::Traits helps a great deal in making the system configurable.

My only quibble is that MooseX::Traits creates an anonymous class as a
subclass with the desired roles "baked in."  This is great, except when
using Log::Log4perl.

Log::Log4perl encourages you to maintain a hierarchy of loggers that matches
your class hierarchy.  I was achieving this by doing:
Log::Log4perl->get_logger(shift->meta->name).  This works great except with
anonymous classes since I can't turn on logging in a particular class unless
I know what the class name will be ahead of time.

Has anyone solved this problem?

Dan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.