Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

This may be an interaction with Log::Log4perl

$logger->trace("Point 9.85"); # create an API notice try {$self->publish_notice( $subject->upload->mapping->map_id, $csv_row->row_id, q(InvalidValue), $csv_row->grain, q(Domain::Products), $item_name // '' );} catch { $logger->trace("point 9.9"); $logger->logdie("Notice failed: ",Dumper($_)); $logger->trace("point 9.92"); die ("Notice failed ".Dumper($_)); }; # stuff something into the log $logger->trace("Point 9.9");

is producing the following log output:

20130518 16:19:53.264 TRACE 29309 PreparePayment.pm(175) _run: Point 9.85 
20130518 16:19:53.268 TRACE 29309 PreparePayment.pm(184) __ANON__: point 9.9 
20130518 16:19:53.269 FATAL 29309 PreparePayment.pm(185) __ANON__: Notice failed: $VAR1 = 'sale-item'; 
20130518 16:19:53.272 ERROR 29309 PreparePayment.pm(78) __ANON__: run(OT::DB::Result::Csv=HASH(0xa47dd00)): $VAR1 = '';

That last log line, from PreparePayment line 78, comes from the $logger call in this:

try { $self->_run($row_id, $subject) } catch { $logger->error("run($row_id): ".Dumper($_)) };

So, you see what's happening there? $self->publish_notice() is failing (in ways that are also impossible) and putting us into the catch block. We log that we're at point 9.9, and we log the "Notice failed" message. That same message should be thrown as an exception by logdie(), and we don't get to point 9.92 so it looks like the die probably happened. However, up around line 78 where we catch that exception, we get an empty string.

It may be relevant that $self->publish_notice is from a Moose::Role, and that $logger calls in there (it fetches its own logger, and checks it's non-null) don't result in log output.

Anybody have any thoughts? I've gone through our previous discussions of Try::Tiny and I don't see any of the problematic things happening here.


In reply to Yet more Try::Tiny problelms by dd-b

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-03-28 20:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found