diff --git a/t/05_condition_nested.t b/t/05_condition_nested.t index 33bdc38..121c1a7 100644 --- a/t/05_condition_nested.t +++ b/t/05_condition_nested.t @@ -5,6 +5,7 @@ use warnings; use lib qw(t); use Test::More; +use Log::Any qw( $log ); my $debug = $ENV{TEST_DEBUG}; @@ -12,22 +13,6 @@ my $debug = $ENV{TEST_DEBUG}; my $cfgbase = $0; $cfgbase =~ s/\.t$/.d/; -my $LOG_FILE = 'workflow_tests.log'; -my $CONF_FILE = $cfgbase . '/log4perl.conf'; - -require Log::Log4perl; -if ($debug) { - if ( -f $LOG_FILE ) { - unlink($LOG_FILE); - } - Log::Log4perl::init($CONF_FILE); -} -else { - no warnings 'once'; - Log::Log4perl::easy_init($Log::Log4perl::OFF); -} - - require Workflow::Factory; @@ -80,7 +65,7 @@ is( $workflow->state, 'INITIALIZED', 'initialized state' ); $workflow->execute_action('test_greedy_or'); is( $workflow->state, 'TEST_GREEDY_OR', 'wfcond state after test_greedy_or' ); -Log::Log4perl::get_logger()->error('START OFFENDING TEST'); +$log->error('START OFFENDING TEST'); $workflow->execute_action('greedy_or_1'); is( $workflow->state, 'INITIALIZED', 'wfcond state after greedy_or_1' ) or $workflow->execute_action('ack_subtest_fail'); diff --git a/t/TestUtil.pm b/t/TestUtil.pm index c10c56a..a56ce01 100644 --- a/t/TestUtil.pm +++ b/t/TestUtil.pm @@ -3,13 +3,16 @@ package TestUtil; use strict; use vars qw($VERSION); use DateTime; +use Log::Any::Adapter; use Test::More; use List::MoreUtils qw(all); $VERSION = '0.02'; -my $LOG_FILE = 't/workflow_tests.log'; -my $CONF_FILE = 't/log4perl.conf'; + +if ($ENV{DEBUG}) { + Log::Any::Adapter->set('Stderr'); +} ######################################## # TICKET INFO @@ -110,21 +113,6 @@ sub init_mock_persister { -# Initialize the logger and other resources; called when module -# required by test - -sub init { - if ( -f $LOG_FILE ) { - unlink( $LOG_FILE ); - } - - require Log::Log4perl; - Log::Log4perl::init( $CONF_FILE ); - -} - -init(); - # Used with state tests with various configs. sub run_state_tests{ my $factory = shift; diff --git a/t/condition.t b/t/condition.t index b1ae201..b3e6ba9 100644 --- a/t/condition.t +++ b/t/condition.t @@ -7,8 +7,6 @@ use Test::More tests => 11; use Test::Exception; no warnings 'once'; -require Log::Log4perl; -Log::Log4perl::easy_init($Log::Log4perl::OFF); require_ok( 'Workflow::Condition' ); diff --git a/t/condition_evaluate.t b/t/condition_evaluate.t index edff90f..c89200d 100644 --- a/t/condition_evaluate.t +++ b/t/condition_evaluate.t @@ -7,8 +7,6 @@ use TestUtil; use Test::More tests => 1; no warnings 'once'; -require Log::Log4perl; -Log::Log4perl::easy_init($Log::Log4perl::OFF); my $wf; diff --git a/t/config.t b/t/config.t index fac96e0..60152f2 100644 --- a/t/config.t +++ b/t/config.t @@ -7,8 +7,6 @@ use Test::More tests => 50; use Test::Exception; no warnings 'once'; -require Log::Log4perl; -Log::Log4perl::easy_init($Log::Log4perl::OFF); my ($parser); diff --git a/t/context-persists.t b/t/context-persists.t index 1f74df5..59196b4 100644 --- a/t/context-persists.t +++ b/t/context-persists.t @@ -11,7 +11,6 @@ use Env qw($TEST_VERBOSE); use lib qw(t); use TestUtil; -#use Log::Log4perl ":easy"; # makes workflow happy use Workflow::Factory qw(FACTORY); diff --git a/t/context.t b/t/context.t index c69da30..e37af5e 100644 --- a/t/context.t +++ b/t/context.t @@ -7,8 +7,6 @@ use Test::More tests => 9; use Test::Exception; no warnings 'once'; -require Log::Log4perl; -Log::Log4perl::easy_init($Log::Log4perl::OFF); require_ok( 'Workflow::Context' ); diff --git a/t/exception.t b/t/exception.t index 1ea1717..f0bbc98 100644 --- a/t/exception.t +++ b/t/exception.t @@ -7,8 +7,6 @@ use Test::More; use Test::Exception; use English qw(-no_match_vars); -use Log::Log4perl qw(:easy); -Log::Log4perl->easy_init($OFF); use_ok( 'Workflow::Exception', qw(workflow_error validation_error configuration_error persist_error) ); diff --git a/t/factory.t b/t/factory.t index 1d55332..5630402 100644 --- a/t/factory.t +++ b/t/factory.t @@ -7,8 +7,6 @@ use Test::More tests => 7; use Test::Exception; no warnings 'once'; -require Log::Log4perl; -Log::Log4perl::easy_init($Log::Log4perl::OFF); require_ok( 'Workflow::Factory' ); diff --git a/t/factory_subclass.t b/t/factory_subclass.t index dd4f8ec..cd58abf 100644 --- a/t/factory_subclass.t +++ b/t/factory_subclass.t @@ -6,8 +6,6 @@ use TestUtil; use Test::More tests => 5; no warnings 'once'; -require Log::Log4perl; -Log::Log4perl::easy_init($Log::Log4perl::OFF); require_ok( 'FactorySubclass' ); diff --git a/t/history.t b/t/history.t index 2f69731..f5b35ad 100644 --- a/t/history.t +++ b/t/history.t @@ -6,8 +6,6 @@ use TestUtil; use Test::More tests => 18; no warnings 'once'; -require Log::Log4perl; -Log::Log4perl::easy_init($Log::Log4perl::OFF); require_ok( 'Workflow::History' ); diff --git a/t/log4perl.conf b/t/log4perl.conf deleted file mode 100644 index 8dbd7f5..0000000 --- a/t/log4perl.conf +++ /dev/null @@ -1,6 +0,0 @@ -log4perl.logger = DEBUG, FileAppender -log4perl.logger.Workflow.Config = DEBUG -log4perl.appender.FileAppender = Log::Log4perl::Appender::File -log4perl.appender.FileAppender.filename = t/workflow_tests.log -log4perl.appender.FileAppender.layout = Log::Log4perl::Layout::PatternLayout -log4perl.appender.FileAppender.layout.ConversionPattern = %d{HH:mm:ss} %p %c %C (%L) %m %n \ No newline at end of file diff --git a/t/persister.t b/t/persister.t index 279e657..fa83f89 100644 --- a/t/persister.t +++ b/t/persister.t @@ -7,8 +7,6 @@ use Test::Exception; use Test::More tests => 18; no warnings 'once'; -require Log::Log4perl; -Log::Log4perl::easy_init($Log::Log4perl::OFF); require_ok( 'Workflow::Persister' ); diff --git a/t/persister_auto_generate_id.t b/t/persister_auto_generate_id.t index c1b32db..8b731ce 100644 --- a/t/persister_auto_generate_id.t +++ b/t/persister_auto_generate_id.t @@ -8,8 +8,6 @@ use Test::Exception; use Mock::MonkeyPatch; no warnings 'once'; -require Log::Log4perl; -Log::Log4perl::easy_init($Log::Log4perl::OFF); require Workflow::Factory; diff --git a/t/persister_dbi_inherit.t b/t/persister_dbi_inherit.t index 0900f88..8ce5c35 100644 --- a/t/persister_dbi_inherit.t +++ b/t/persister_dbi_inherit.t @@ -4,8 +4,6 @@ use strict; use lib qw(t); use Test::More; -use Log::Log4perl qw(:easy); -Log::Log4perl->easy_init($OFF); eval "require DBI"; if ( $@ ) { diff --git a/t/persister_dbi_sqlite.t b/t/persister_dbi_sqlite.t index d63baff..e77d5bf 100644 --- a/t/persister_dbi_sqlite.t +++ b/t/persister_dbi_sqlite.t @@ -5,7 +5,6 @@ use lib qw(t); use TestUtil; use constant NUM_TESTS => 15; use Test::More; -use Log::Log4perl qw( get_logger ); use TestDBUtil; eval "require DBI"; diff --git a/t/persister_sequence_id.t b/t/persister_sequence_id.t index c656e8d..3c47e0c 100644 --- a/t/persister_sequence_id.t +++ b/t/persister_sequence_id.t @@ -8,8 +8,6 @@ use Test::Exception; use Mock::MonkeyPatch; no warnings 'once'; -require Log::Log4perl; -Log::Log4perl::easy_init($Log::Log4perl::OFF); require Workflow::Factory; diff --git a/t/validator.t b/t/validator.t index 74bf3ae..e666a8c 100644 --- a/t/validator.t +++ b/t/validator.t @@ -7,8 +7,6 @@ use Test::More tests => 2; use Test::Exception; no warnings 'once'; -require Log::Log4perl; -Log::Log4perl::easy_init($Log::Log4perl::OFF); require_ok( 'Workflow::Validator' ); diff --git a/t/validator_has_required_field.t b/t/validator_has_required_field.t index 9b718b6..68e1513 100644 --- a/t/validator_has_required_field.t +++ b/t/validator_has_required_field.t @@ -6,8 +6,6 @@ use TestUtil; use Test::More tests => 1; no warnings 'once'; -require Log::Log4perl; -Log::Log4perl::easy_init($Log::Log4perl::OFF); require_ok( 'Workflow::Validator::HasRequiredField' ); diff --git a/t/validator_matches_date_format.t b/t/validator_matches_date_format.t index 056240f..ecd394b 100644 --- a/t/validator_matches_date_format.t +++ b/t/validator_matches_date_format.t @@ -6,8 +6,6 @@ use Test::Exception; use DateTime; use Test::More; -use Log::Log4perl qw(:easy); -Log::Log4perl->easy_init($OFF); require_ok( 'Workflow::Validator::MatchesDateFormat');