[Catalyst] Re: Puzzlement about logging
robrwo at gmail.com
Mon Mar 18 16:07:37 GMT 2013
I've found a solution, sort of.
After creating the Catalyst contexts (using CatalystX::Test::MockContext), I
add the following to the tests
my $log = Test::Log::Dispatch->new();
and then use the methods in $log to test the output of logs in the database
It also seems to capture the output of logs in the controller tests.
BUT it still doesn't explain the inconsistent behaviour: why are the log
messages not being output to STDERR in one set of tests, and then being
output to STDERR in a way that isn't captured in another set of tests.
BTW, I did verify tha the $c->log object has the properly configured
On 18/03/13 15:38 Robert Rothenberg wrote:
> I have a strange issue with testing the output to $c->log->info in some tests.
> The app has various database roles that act as wrappers for tables,
> basically to ensure consistency of behaviour, such as whether the user has
> access to the table, emitting log messages that records were created/updated
> etc. (The role methods take the Catalyst context as a parameter.)
> When running the tests of database roles, no log messages are output.
> BUT when running tests of the API controller methods using
> Test::WWW::Mechanize::Catalyst, log messages are output.
> Even stranger, to set up these tests, we run the same database record
> creation methods to add records to test in the API. These do output log
> messages, AND they cannot be captured to be tested using Capture::Tiny.
> Has anyone run into something like this before?
More information about the Catalyst