diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/ExternalLibraryBootstrap.java b/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/ExternalLibraryBootstrap.java
index e0d7e6e..d2f3345 100755
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/ExternalLibraryBootstrap.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/ExternalLibraryBootstrap.java
@@ -178,31 +178,58 @@
                 MetadataManager.INSTANCE.addDataverse(mdTxnCtx, new Dataverse(dataverse,
                         NonTaggedDataFormat.NON_TAGGED_DATA_FORMAT, IMetadataEntity.PENDING_NO_OP));
             }
-            for (LibraryFunction function : library.getLibraryFunctions().getLibraryFunction()) {
-                String[] fargs = function.getArguments().trim().split(",");
-                List<String> args = new ArrayList<String>();
-                for (String arg : fargs) {
-                    args.add(arg);
+            if (library.getLibraryFunctions() != null) {
+                for (LibraryFunction function : library.getLibraryFunctions().getLibraryFunction()) {
+                    String[] fargs = function.getArguments().trim().split(",");
+                    List<String> args = new ArrayList<String>();
+                    for (String arg : fargs) {
+                        args.add(arg);
+                    }
+                    edu.uci.ics.asterix.metadata.entities.Function f = new edu.uci.ics.asterix.metadata.entities.Function(
+                            dataverse, libraryName + "#" + function.getName(), args.size(), args,
+                            function.getReturnType(), function.getDefinition(), library.getLanguage(),
+                            function.getFunctionType());
+                    MetadataManager.INSTANCE.addFunction(mdTxnCtx, f);
+                    if (LOGGER.isLoggable(Level.INFO)) {
+                        LOGGER.info("Installed function: " + libraryName + "#" + function.getName());
+                    }
                 }
-                edu.uci.ics.asterix.metadata.entities.Function f = new edu.uci.ics.asterix.metadata.entities.Function(
-                        dataverse, libraryName + "#" + function.getName(), args.size(), args, function.getReturnType(),
-                        function.getDefinition(), library.getLanguage(), function.getFunctionType());
-                MetadataManager.INSTANCE.addFunction(mdTxnCtx, f);
             }
 
-            for (LibraryAdapter adapter : library.getLibraryAdapters().getLibraryAdapter()) {
-                String adapterFactoryClass = adapter.getFactoryClass();
-                String adapterName = libraryName + "#" + adapter.getName();
-                AdapterIdentifier aid = new AdapterIdentifier(dataverse, adapterName);
-                DatasourceAdapter dsa = new DatasourceAdapter(aid, adapterFactoryClass, AdapterType.EXTERNAL);
-                MetadataManager.INSTANCE.addAdapter(mdTxnCtx, dsa);
+            if (LOGGER.isLoggable(Level.INFO)) {
+                LOGGER.info("Installed functions contain in library :" + libraryName);
+            }
+
+            if (library.getLibraryAdapters() != null) {
+                for (LibraryAdapter adapter : library.getLibraryAdapters().getLibraryAdapter()) {
+                    String adapterFactoryClass = adapter.getFactoryClass();
+                    String adapterName = libraryName + "#" + adapter.getName();
+                    AdapterIdentifier aid = new AdapterIdentifier(dataverse, adapterName);
+                    DatasourceAdapter dsa = new DatasourceAdapter(aid, adapterFactoryClass, AdapterType.EXTERNAL);
+                    MetadataManager.INSTANCE.addAdapter(mdTxnCtx, dsa);
+                    if (LOGGER.isLoggable(Level.INFO)) {
+                        LOGGER.info("Installed adapter: " + adapterName);
+                    }
+                }
+            }
+
+            if (LOGGER.isLoggable(Level.INFO)) {
+                LOGGER.info("Installed adapters contain in library :" + libraryName);
             }
 
             MetadataManager.INSTANCE.addLibrary(mdTxnCtx, new edu.uci.ics.asterix.metadata.entities.Library(dataverse,
                     libraryName));
+
+            if (LOGGER.isLoggable(Level.INFO)) {
+                LOGGER.info("Added library " + libraryName + "to Metadata");
+            }
+
             MetadataManager.INSTANCE.commitTransaction(mdTxnCtx);
         } catch (Exception e) {
             e.printStackTrace();
+            if (LOGGER.isLoggable(Level.SEVERE)) {
+                LOGGER.info("Exception in installing library " + libraryName);
+            }
             MetadataManager.INSTANCE.abortTransaction(mdTxnCtx);
         }
     }
diff --git a/asterix-installer/src/test/java/edu/uci/ics/asterix/installer/test/AsterixExternalLibraryIT.java b/asterix-installer/src/test/java/edu/uci/ics/asterix/installer/test/AsterixExternalLibraryIT.java
index daa8bb5..b993aab 100644
--- a/asterix-installer/src/test/java/edu/uci/ics/asterix/installer/test/AsterixExternalLibraryIT.java
+++ b/asterix-installer/src/test/java/edu/uci/ics/asterix/installer/test/AsterixExternalLibraryIT.java
@@ -28,58 +28,51 @@
 
 public class AsterixExternalLibraryIT {
 
-	private static final String LIBRARY_NAME = "testlib";
-	private static final String LIBRARY_DATAVERSE = "externallibtest";
-	private static final String PATH_BASE = "src/test/resources/integrationts/library";
-	private static final String PATH_ACTUAL = "ittest/";
-	private static final String LIBRARY_PATH = "asterix-external-data"
-			+ File.separator + "target" + File.separator
-			+ "testlib-zip-binary-assembly.zip";
-	private static final Logger LOGGER = Logger
-			.getLogger(AsterixExternalLibraryIT.class.getName());
-	private static List<TestCaseContext> testCaseCollection;
+    private static final String LIBRARY_NAME = "testlib";
+    private static final String LIBRARY_DATAVERSE = "externallibtest";
+    private static final String PATH_BASE = "src/test/resources/integrationts/library";
+    private static final String PATH_ACTUAL = "ittest/";
+    private static final String LIBRARY_PATH = "asterix-external-data" + File.separator + "target" + File.separator
+            + "testlib-zip-binary-assembly.zip";
+    private static final Logger LOGGER = Logger.getLogger(AsterixExternalLibraryIT.class.getName());
+    private static List<TestCaseContext> testCaseCollection;
 
-	@BeforeClass
-	public static void setUp() throws Exception {
-		AsterixInstallerIntegrationUtil.init();
-		File asterixInstallerProjectDir = new File(System
-				.getProperty("user.dir"));
-		String asterixExternalLibraryPath = asterixInstallerProjectDir
-				.getParentFile().getAbsolutePath()
-				+ File.separator + LIBRARY_PATH;
-		LOGGER.info("Installing library :" + LIBRARY_NAME + " located at "
-				+ asterixExternalLibraryPath + " in dataverse "
-				+ LIBRARY_DATAVERSE);
-		AsterixInstallerIntegrationUtil.installLibrary(LIBRARY_NAME,
-				LIBRARY_DATAVERSE, asterixExternalLibraryPath);
-		AsterixInstallerIntegrationUtil
-				.transformIntoRequiredState(State.ACTIVE);
-		TestCaseContext.Builder b = new TestCaseContext.Builder();
-		testCaseCollection = b.build(new File(PATH_BASE));
-	}
+    @BeforeClass
+    public static void setUp() throws Exception {
+        AsterixInstallerIntegrationUtil.init();
+        File asterixInstallerProjectDir = new File(System.getProperty("user.dir"));
+        String asterixExternalLibraryPath = asterixInstallerProjectDir.getParentFile().getAbsolutePath()
+                + File.separator + LIBRARY_PATH;
+        LOGGER.info("Installing library :" + LIBRARY_NAME + " located at " + asterixExternalLibraryPath
+                + " in dataverse " + LIBRARY_DATAVERSE);
+        AsterixInstallerIntegrationUtil.installLibrary(LIBRARY_NAME, LIBRARY_DATAVERSE, asterixExternalLibraryPath);
+        AsterixInstallerIntegrationUtil.transformIntoRequiredState(State.ACTIVE);
+        TestCaseContext.Builder b = new TestCaseContext.Builder();
+        testCaseCollection = b.build(new File(PATH_BASE));
+    }
 
-	@AfterClass
-	public static void tearDown() throws Exception {
-		AsterixInstallerIntegrationUtil.deinit();
-	}
+    @AfterClass
+    public static void tearDown() throws Exception {
+        AsterixInstallerIntegrationUtil.deinit();
+    }
 
-	@Test
-	public void test() throws Exception {
-		for (TestCaseContext testCaseCtx : testCaseCollection) {
-			TestsUtils.executeTest(PATH_ACTUAL, testCaseCtx);
-		}
-	}
+    @Test
+    public void test() throws Exception {
+        for (TestCaseContext testCaseCtx : testCaseCollection) {
+            TestsUtils.executeTest(PATH_ACTUAL, testCaseCtx);
+        }
+    }
 
-	public static void main(String[] args) throws Exception {
-		try {
-			setUp();
-			new AsterixExternalLibraryIT().test();
-		} catch (Exception e) {
-		    e.printStackTrace();
-			LOGGER.info("TEST CASES FAILED");
-		} finally {
-			tearDown();
-		}
-	}
+    public static void main(String[] args) throws Exception {
+        try {
+            setUp();
+            new AsterixExternalLibraryIT().test();
+        } catch (Exception e) {
+            e.printStackTrace();
+            LOGGER.info("TEST CASES FAILED");
+        } finally {
+            tearDown();
+        }
+    }
 
 }
diff --git a/asterix-installer/src/test/java/edu/uci/ics/asterix/installer/test/AsterixInstallerIntegrationUtil.java b/asterix-installer/src/test/java/edu/uci/ics/asterix/installer/test/AsterixInstallerIntegrationUtil.java
index 1096a4d..4574f45 100644
--- a/asterix-installer/src/test/java/edu/uci/ics/asterix/installer/test/AsterixInstallerIntegrationUtil.java
+++ b/asterix-installer/src/test/java/edu/uci/ics/asterix/installer/test/AsterixInstallerIntegrationUtil.java
@@ -62,6 +62,8 @@
 
 	public static void init() throws Exception {
 		File asterixProjectDir = new File(System.getProperty("user.dir"));
+		
+		
 		File installerTargetDir = new File(asterixProjectDir, "target");
 		String managixHomeDirName = installerTargetDir
 				.list(new FilenameFilter() {
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/bootstrap/MetadataBootstrap.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/bootstrap/MetadataBootstrap.java
index f2c8b5c..a1f6c38 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/bootstrap/MetadataBootstrap.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/bootstrap/MetadataBootstrap.java
@@ -169,6 +169,11 @@
                 for (int i = 0; i < secondaryIndexes.length; i++) {
                     enlistMetadataDataset(secondaryIndexes[i], true, mdTxnCtx);
                 }
+
+                if (LOGGER.isLoggable(Level.INFO)) {
+                    LOGGER.info("Finished enlistment of metadata B-trees in  new universe");
+                }
+
                 insertInitialDataverses(mdTxnCtx);
                 insertInitialDatasets(mdTxnCtx);
                 insertInitialDatatypes(mdTxnCtx);
@@ -191,7 +196,7 @@
                 }
 
                 if (LOGGER.isLoggable(Level.INFO)) {
-                    LOGGER.info("Finished enlistment of metadata B-trees.");
+                    LOGGER.info("Finished enlistment of metadata B-trees in old universe.");
                 }
             }
 
@@ -248,6 +253,9 @@
                     id, new HashMap<String, String>(), DatasetType.INTERNAL, primaryIndexes[i].getDatasetId().getId(),
                     IMetadataEntity.PENDING_NO_OP));
         }
+        if (LOGGER.isLoggable(Level.INFO)) {
+            LOGGER.info("Finished inserting initial datasets.");
+        }
     }
 
     public static void getBuiltinTypes(ArrayList<IAType> types) throws Exception {
@@ -271,6 +279,9 @@
             MetadataManager.INSTANCE.addDatatype(mdTxnCtx, new Datatype(dataverseName, types.get(i).getTypeName(),
                     types.get(i), false));
         }
+        if (LOGGER.isLoggable(Level.INFO)) {
+            LOGGER.info("Finished inserting initial datatypes.");
+        }
     }
 
     public static void insertInitialIndexes(MetadataTransactionContext mdTxnCtx) throws Exception {
@@ -279,6 +290,9 @@
                     secondaryIndexes[i].getIndexedDatasetName(), secondaryIndexes[i].getIndexName(), IndexType.BTREE,
                     secondaryIndexes[i].getPartitioningExpr(), false, IMetadataEntity.PENDING_NO_OP));
         }
+        if (LOGGER.isLoggable(Level.INFO)) {
+            LOGGER.info("Finished inserting initial indexes.");
+        }
     }
 
     public static void insertNodes(MetadataTransactionContext mdTxnCtx) throws Exception {
@@ -325,12 +339,18 @@
             adapter = getAdapter(adapterClassName);
             MetadataManager.INSTANCE.addAdapter(mdTxnCtx, adapter);
         }
+        if (LOGGER.isLoggable(Level.INFO)) {
+            LOGGER.info("Finished inserting built-in adapters.");
+        }
     }
 
     private static void insertInitialFeedPolicies(MetadataTransactionContext mdTxnCtx) throws Exception {
         for (FeedPolicy feedPolicy : BuiltinFeedPolicies.policies) {
             MetadataManager.INSTANCE.addFeedPolicy(mdTxnCtx, feedPolicy);
         }
+        if (LOGGER.isLoggable(Level.INFO)) {
+            LOGGER.info("Finished adding built-in feed policies.");
+        }
     }
 
     private static void insertInitialCompactionPolicies(MetadataTransactionContext mdTxnCtx) throws Exception {
