Index: main/trunk/greenstone2/bin/script/activate.pl
===================================================================
--- main/trunk/greenstone2/bin/script/activate.pl	(revision 31408)
+++ main/trunk/greenstone2/bin/script/activate.pl	(revision 31409)
@@ -358,5 +358,5 @@
 
     # now we've moved building to index, move tmp oaidb to live oaidb in parallel
-    my $oai_info = new oaiinfo($collect_cfg_filename, $collectcfg->{'infodbtype'});
+    my $oai_info = new oaiinfo($collect_cfg_filename, $collectcfg->{'infodbtype'}, $default_verbosity);
     $oai_info->activate_collection();
 
Index: main/trunk/greenstone2/perllib/basebuilder.pm
===================================================================
--- main/trunk/greenstone2/perllib/basebuilder.pm	(revision 31408)
+++ main/trunk/greenstone2/perllib/basebuilder.pm	(revision 31409)
@@ -183,5 +183,5 @@
     
     my $archivedir = $self->{'source_dir'};
-    my $oai_info = new oaiinfo($self->{'colcfgname'}, $self->{'collect_cfg'}->{'infodbtype'});    
+    my $oai_info = new oaiinfo($self->{'colcfgname'}, $self->{'collect_cfg'}->{'infodbtype'}, $self->{'verbosity'});    
     $oai_info->building_stage_before_indexing($archivedir);
 
Index: main/trunk/greenstone2/perllib/inexport.pm
===================================================================
--- main/trunk/greenstone2/perllib/inexport.pm	(revision 31408)
+++ main/trunk/greenstone2/perllib/inexport.pm	(revision 31409)
@@ -734,5 +734,5 @@
     # Prepare to work with the <collection>/etc/oai-inf.<db> that keeps track
     # of the OAI identifiers with their time stamps and deleted status.    
-    my $oai_info = new oaiinfo($self->{'config_filename'}, $collectcfg->{'infodbtype'});
+    my $oai_info = new oaiinfo($self->{'config_filename'}, $collectcfg->{'infodbtype'}, $verbosity);
     my $have_manifest = ($manifest eq '') ? 0 : 1;    
     $oai_info->import_stage($removeold, $have_manifest);
Index: main/trunk/greenstone2/perllib/oaiinfo.pm
===================================================================
--- main/trunk/greenstone2/perllib/oaiinfo.pm	(revision 31408)
+++ main/trunk/greenstone2/perllib/oaiinfo.pm	(revision 31409)
@@ -28,7 +28,9 @@
 sub new {
     my $class = shift(@_);
-    my ($config_filename, $infodbtype) = @_;
+    my ($config_filename, $infodbtype, $verbosity) = @_;
  
     my $self = { 
+	'verbosity' => $verbosity || 0,
+	'verbosity_threshold' => 5, # start printing debugging info from verbosity >= threshold
 	'info'=>{} # map of {OID, array[deletion-status,timestamp,datestamp]} pairs
     };
@@ -47,6 +49,6 @@
     $self->{'oaidb_tmp_filepath'} = &dbutil::get_infodb_file_path($infodbtype, "oai-inf-tmp", $etc_dir, $perform_firsttime_init);
     $self->{'etc_dir'} = $etc_dir;
-#    print STDERR "############ LIVE DB: $self->{'oaidb_live_filepath'}\n";
-#    print STDERR "############ TMP DB: $self->{'oaidb_tmp_filepath'}\n";
+#    print STDERR "############ LIVE DB: $self->{'oaidb_live_filepath'}\n" if $self->{'verbosity'} >= $self->{'verbosity_threshold'};
+#    print STDERR "############ TMP DB: $self->{'oaidb_tmp_filepath'}\n" if $self->{'verbosity'} >= $self->{'verbosity_threshold'};
 
     $self->{'oaidb_file_path'} = $self->{'oaidb_tmp_filepath'}; # db file we're working with
@@ -184,5 +186,5 @@
                                  # final param follows jmt's $perform_firsttime_init in inexport.pm
 
-#    print STDERR "@@@@@ oaidb: $self->{'oaidb_file_path'}\n";
+#    print STDERR "@@@@@ oaidb: $self->{'oaidb_file_path'}\n" if $self->{'verbosity'} >= $self->{'verbosity_threshold'};
     
     return $do_pd_step;
@@ -197,5 +199,5 @@
     my $self = shift (@_);
     my ($removeold, $have_manifest) = @_;
-    
+	
     my $do_pd_step = $self->init_tmpdb($removeold, $have_manifest);
       # returns 1 if the step to mark oaidb entries as PD is required
@@ -244,5 +246,5 @@
 	             # see http://perldoc.perl.org/constant.html
 
-	print STDERR "######## OID: $OID - status: $indexing_status\n";
+	print STDERR "######## OID: $OID - status: $indexing_status\n" if $self->{'verbosity'} >= $self->{'verbosity_threshold'};
 
 	if($indexing_status eq "I") {
@@ -257,5 +259,7 @@
 	    # an oaicollection. But what if we always maintain an oaidb? Still call $self->index() here.
 	} else {
-	    print STDERR "### oaiinfo::building_stage_before_indexing(): Unrecognised indexing status $indexing_status\n";
+		if ($self->{'verbosity'} >= $self->{'verbosity_threshold'}) {
+			print STDERR "### oaiinfo::building_stage_before_indexing(): Unrecognised indexing status $indexing_status\n";
+		}
 	}
     }
@@ -288,10 +292,14 @@
 	&dbutil::rename_db_file_to($self->{'infodbtype'}, $oaidb_tmp_filepath, $oaidb_live_filepath); # rename the db file and any assoc files
 
-	print STDERR "#### Should now have MOVED $self->{'oaidb_tmp_filepath'} to $self->{'oaidb_live_filepath'}\n"; 
+	if ($self->{'verbosity'} >= $self->{'verbosity_threshold'}) {
+		print STDERR "#### Should now have MOVED $self->{'oaidb_tmp_filepath'} to $self->{'oaidb_live_filepath'}\n";
+	}
 	
     } else {
-	print STDERR "@@@@@ In oaiinfo::activate_collection():\n";
-	print STDERR "@@@@@   No tmpdb at $self->{'oaidb_tmp_filepath'}\n";
-	print STDERR "@@@@@   to make 'live' by moving to $self->{'oaidb_live_filepath'}.\n";
+		if ($self->{'verbosity'} >= $self->{'verbosity_threshold'}) {
+			print STDERR "@@@@@ In oaiinfo::activate_collection():\n";
+			print STDERR "@@@@@   No tmpdb at $self->{'oaidb_tmp_filepath'}\n";
+			print STDERR "@@@@@   to make 'live' by moving to $self->{'oaidb_live_filepath'}.\n";
+		}
     }
 }
@@ -306,5 +314,5 @@
     my $self = shift (@_);
     
-    print STDERR "@@@@@ oaiinfo::mark_all_E_as_PD(): Marking the E entries as PD\n";
+    print STDERR "@@@@@ oaiinfo::mark_all_E_as_PD(): Marking the E entries as PD\n" if $self->{'verbosity'} >= $self->{'verbosity_threshold'};
 
 	my $infomap = $self->{'info'};
@@ -324,5 +332,5 @@
     my $self = shift (@_);
     
-    print STDERR "@@@@@ oaiinfo::mark_all_PD_as_D(): Marking the PD entries as D\n";
+    print STDERR "@@@@@ oaiinfo::mark_all_PD_as_D(): Marking the PD entries as D\n" if $self->{'verbosity'} >= $self->{'verbosity_threshold'};
 
 	my $infomap = $self->{'info'};
@@ -343,4 +351,8 @@
     my $self = shift (@_);
 
+	if ($self->{'verbosity'} < $self->{'verbosity_threshold'}) {
+		return;
+	}	
+	
     print STDERR "###########################################################\n";
     print STDERR "@@@@@ oaiinfo::print_info(): oaidb in memory contains: \n";
