From 94566f012421026c8311552f99175a5989eba063 Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Sat, 1 Nov 2014 01:47:12 +0000 Subject: Log-Log4perl-1.46 --- t/006Config-Java.t | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 t/006Config-Java.t (limited to 't/006Config-Java.t') diff --git a/t/006Config-Java.t b/t/006Config-Java.t new file mode 100644 index 0000000..bf252fe --- /dev/null +++ b/t/006Config-Java.t @@ -0,0 +1,74 @@ +########################################### +# Test Suite for Log::Log4perl::Config +# Mike Schilli, 2002 (m@perlmeister.com) +########################################### + +BEGIN { + if($ENV{INTERNAL_DEBUG}) { + require Log::Log4perl::InternalDebug; + Log::Log4perl::InternalDebug->enable(); + } +} + +######################### +# change 'tests => 1' to 'tests => last_test_to_print'; +######################### +use Test::More; + +our $LOG_DISPATCH_PRESENT = 0; + +BEGIN { + eval { require Log::Dispatch; }; + if($@) { + plan skip_all => "only with Log::Dispatch"; + } else { + $LOG_DISPATCH_PRESENT = 1; + plan tests => 2; + } +}; + +use Log::Log4perl; +use Log::Log4perl::Appender::TestBuffer; +use File::Spec; + +my $EG_DIR = "eg"; +$EG_DIR = "../eg" unless -d $EG_DIR; + +ok(1); # If we made it this far, we're ok. + +my $LOGFILE = "example-java.log"; +unlink $LOGFILE; + +#Log::Log4perl->init( +# File::Spec->catfile($EG_DIR, 'log4j-file-append-java.conf')); +Log::Log4perl->init("$EG_DIR/log4j-file-append-java.conf"); + + +my $logger = Log::Log4perl->get_logger(""); +my $lines = (); +my $line = __LINE__ + 1; +push @lines, $line++; $logger->debug("Gurgel"); +push @lines, $line++; $logger->info("Gurgel"); +push @lines, $line++; $logger->warn("Gurgel"); +push @lines, $line++; $logger->error("Gurgel"); +push @lines, $line++; $logger->fatal("Gurgel"); + +open FILE, "<$LOGFILE" or die "Cannot open $LOGFILE"; +my $data = join '', ; +close FILE; + +my $file = "t/006Config-Java.t"; + +my $exp = <