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

[email protected] (Stevan Little)
Newsgroups perl.moose
Message-ID <[email protected]>
Dan,

That is not MooseX::Traits so much as it is just how role-application- 
to-instances works (it must create an anon class to apply the role  
to). Anon classes do share a common prefix though, so perhaps you can  
use that?

- Stevan

On Jan 19, 2009, at 1:35 PM, Dan Harbin wrote:

> 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.