in reply to Re: apply_all_roles method clobbering MooseX::Log::Log4perl
in thread apply_all_roles method clobbering MooseX::Log::Log4perl

Bracket was accidentally not pasted in. It is not added with 'with' because it would typically be conditionally added. I didn't show that logic because it's not pertinent to the question.

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks

  • Comment on Re^2: apply_all_roles method clobbering MooseX::Log::Log4perl

Replies are listed 'Best First'.
Re^3: apply_all_roles method clobbering MooseX::Log::Log4perl
by 1nickt (Canon) on Jan 18, 2018 at 16:07 UTC

    I have not used Log4Perl nor do I use Moose any more. However, I use Role::Tiny and Moo, and when you apply a Role to an object manually, the object is reblessed into the resultant class, which will have a name something like 'Foo::Bar_WITH_Bar::Baz', so if your logger config is dependent on the class name, that could be the source of the problem.

    Things I would think are "pertinent to the question":

    • Does the same behaviour occur when you consume the role with with?
    • Does the same behaviour occur when you apply the role elsewhere than in the BUILD sub? E.g. using after BUILD?
    • Does the same behaviour occur when you create a minimalist test case?
    • Does the same behaviour occur when using Role::Tiny::apply_roles_to_object?
    • Does the same behaviour occur when testing with a role other than the Log4Perl one?

    Hope this helps!


    The way forward always starts with a minimal test.