[Dbix-class] ->deploy() trashes Log4perl configuration?

Adam Jacob adam at stalecoffee.org
Thu May 24 17:04:21 GMT 2007


On Thu, May 24, 2007 at 09:38:27AM +0100, Jess Robinson wrote:
> 
> On Thu, 24 May 2007, Adrian Corston wrote:
> 
> >Adrian Corston wrote:
> >>
> >> The following example code shows that Log4perl's configuration is being
> >> trashed when calling ->deploy().  The failure behaviour is demonstrated 
> >> by
> >> the lack of a "debug after" debug message.
> >>
> >
> >mst says "if bits of SQLT fail please post patches to the DBIC list" so 
> >here is patch and a test.
> >
> 
> Thanks, but..
> 
> I'm reluctant to apply a patch that "just removes the offending bit" 
> without explanations of what that does, and why removing it doesnt break 
> things.. Does that really solve your problem? I thought SQLT only loaded 
> the Parser/Producer currently being used, which shouldn't be Graph.

The issue of Log::Log4perl being re-initialized (and clobbering the old
configuration) is common enough to warrant this in the perldoc:

 Initialize once and only once

 It’s important to realize that Log::Log4perl gets initialized once and
 only once, typically at the start of a program or system. Calling
 "init()" more than once will cause it to clobber the existing configu‐
 ration and replace it by the new one.

Removing it outright, as his patch did, will certainly break things for
users who haven't initialized Log::Log4perl and expect the Graph module
to utilize it.  Adding the check on Log::Log4perl->initialized is the
solution.

Regards,
Adam

-- 
HJK Solutions - We Launch Startups - http://www.hjksolutions.com
Adam Jacob, Senior Partner
T: (206) 508-4759 E: adam at hjksolutions.com



More information about the Dbix-class mailing list