Project

General

Profile

« Previous | Next » 

Revision 42434

better logging

View differences:

modules/dnet-gridfs-objectstore/branches/tag/src/main/java/eu/dnetlib/data/objectstore/modular/gridFS/GridFSObjectStore.java
590 590
	@Override
591 591
	public int tagObjectstore(final String tag) {
592 592

  
593
		log.info(String.format("Starting to tag (%s) for object store %s" , tag, id));
593
		log.info(String.format("Starting to tag (%s) object store %s" , tag, id));
594
		final double start = System.currentTimeMillis();
594 595
		final BasicDBObject fields = new BasicDBObject("metadata.tags", tag);
595 596
		final BasicDBObject update = new BasicDBObject("$push", fields);
596 597
		final DBCollection mongoCollection = collection.getDB().getCollection(collection.getBucketName() + ".files");
597 598
		final WriteResult result = mongoCollection.update(new BasicDBObject(), update, true, true);
599
		final double elapsed = (System.currentTimeMillis() - start) / 1000;
600
		log.info(String.format("Ended to tag (%s) for object store %s. Elapsed time: %d seconds." , tag, id, elapsed));
601

  
598 602
		return result.getN();
599 603

  
600 604
	}
......
610 614
	public int untagObjectstore(final String tag) {
611 615

  
612 616
		log.info(String.format("Starting to untag (%s) for object store %s" , tag, id));
617
		final double start = System.currentTimeMillis();
613 618
		final BasicDBList objects = new BasicDBList();
614 619
		objects.add(tag);
615 620
		final BasicDBObject fields = new BasicDBObject("metadata.tags", new BasicDBObject("$in", objects));
......
618 623
		DBCollection mongoCollection = collection.getDB().getCollection(collection.getBucketName() + ".files");
619 624

  
620 625
		final WriteResult result = mongoCollection.update(new BasicDBObject(), update, true, true);
626
		final double elapsed = (System.currentTimeMillis() - start) / 1000;
627
		log.info(String.format("Ended to untag (%s) for object store %s. Elapsed time: %d seconds." , tag, id, elapsed));
621 628
		return result.getN();
622 629

  
623 630
	}

Also available in: Unified diff