validation OPTIMIZE set log nodes only before an error

Some logging improvements included.
diff --git a/tests/utests/extensions/test_metadata.c b/tests/utests/extensions/test_metadata.c
index 39d29be..f1edd29 100644
--- a/tests/utests/extensions/test_metadata.c
+++ b/tests/utests/extensions/test_metadata.c
@@ -53,7 +53,7 @@
             "md:annotation aa;}";
     assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YANG, NULL));
     CHECK_LOG_CTX("Ext plugin \"ly2 metadata v1\": Missing mandatory keyword \"type\" as a child of \"md:annotation aa\".",
-            "/aa:{extension='md:annotation'}/aa");
+            "Path \"/aa:{extension='md:annotation'}/aa\".");
 
     /* not allowed substatement */
     data = "module aa {yang-version 1.1; namespace urn:tests:extensions:metadata:aa; prefix aa;"
@@ -61,7 +61,7 @@
             "md:annotation aa {default x;}}";
     assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YANG, NULL));
     CHECK_LOG_CTX("Invalid keyword \"default\" as a child of \"md:annotation aa\" extension instance.",
-            "/aa:{extension='md:annotation'}/aa");
+            "Path \"/aa:{extension='md:annotation'}/aa\".");
 
     /* invalid cardinality of units substatement */
     data = "module aa {yang-version 1.1; namespace urn:tests:extensions:metadata:aa; prefix aa;"
@@ -69,7 +69,7 @@
             "md:annotation aa {type string; units x; units y;}}";
     assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YANG, NULL));
     CHECK_LOG_CTX("Duplicate keyword \"units\".",
-            "/aa:{extension='md:annotation'}/aa");
+            "Path \"/aa:{extension='md:annotation'}/aa\".");
 
     /* invalid cardinality of status substatement */
     data = "module aa {yang-version 1.1; namespace urn:tests:extensions:metadata:aa; prefix aa;"
@@ -77,7 +77,7 @@
             "md:annotation aa {type string; status current; status obsolete;}}";
     assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YANG, NULL));
     CHECK_LOG_CTX("Duplicate keyword \"status\".",
-            "/aa:{extension='md:annotation'}/aa");
+            "Path \"/aa:{extension='md:annotation'}/aa\".");
 
     /* invalid cardinality of status substatement */
     data = "module aa {yang-version 1.1; namespace urn:tests:extensions:metadata:aa; prefix aa;"
@@ -85,7 +85,7 @@
             "md:annotation aa {type string; type uint8;}}";
     assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YANG, NULL));
     CHECK_LOG_CTX("Duplicate keyword \"type\".",
-            "/aa:{extension='md:annotation'}/aa");
+            "Path \"/aa:{extension='md:annotation'}/aa\".");
 
     /* duplication of the same annotation */
     data = "module aa {yang-version 1.1; namespace urn:tests:extensions:metadata:aa; prefix aa;"
@@ -93,7 +93,7 @@
             "md:annotation aa {type string;} md:annotation aa {type uint8;}}";
     assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YANG, NULL));
     CHECK_LOG_CTX("Ext plugin \"ly2 metadata v1\": Extension md:annotation is instantiated multiple times.",
-            "/aa:{extension='md:annotation'}/aa");
+            "Path \"/aa:{extension='md:annotation'}/aa\".");
 }
 
 static void
@@ -134,7 +134,7 @@
             "</module>";
     assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YIN, NULL));
     CHECK_LOG_CTX("Ext plugin \"ly2 metadata v1\": Missing mandatory keyword \"type\" as a child of \"md:annotation aa\".",
-            "/aa:{extension='md:annotation'}/aa");
+            "Path \"/aa:{extension='md:annotation'}/aa\".");
 
     /* not allowed substatement */
     data = "<module xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\" xmlns:md=\"urn:ietf:params:xml:ns:yang:ietf-yang-metadata\" name=\"aa\">\n"
@@ -145,7 +145,7 @@
             "</md:annotation></module>";
     assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YIN, NULL));
     CHECK_LOG_CTX("Invalid keyword \"default\" as a child of \"md:annotation aa\" extension instance.",
-            "/aa:{extension='md:annotation'}/aa");
+            "Path \"/aa:{extension='md:annotation'}/aa\".");
 
     /* invalid cardinality of units substatement */
     data = "<module xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\" xmlns:md=\"urn:ietf:params:xml:ns:yang:ietf-yang-metadata\" name=\"aa\">\n"
@@ -158,7 +158,7 @@
             "</md:annotation></module>";
     assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YIN, NULL));
     CHECK_LOG_CTX("Duplicate keyword \"units\".",
-            "/aa:{extension='md:annotation'}/aa");
+            "Path \"/aa:{extension='md:annotation'}/aa\".");
 
     /* invalid cardinality of status substatement */
     data = "<module xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\" xmlns:md=\"urn:ietf:params:xml:ns:yang:ietf-yang-metadata\" name=\"aa\">\n"
@@ -171,7 +171,7 @@
             "</md:annotation></module>";
     assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YIN, NULL));
     CHECK_LOG_CTX("Duplicate keyword \"status\".",
-            "/aa:{extension='md:annotation'}/aa");
+            "Path \"/aa:{extension='md:annotation'}/aa\".");
 
     /* invalid cardinality of status substatement */
     data = "<module xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\" xmlns:md=\"urn:ietf:params:xml:ns:yang:ietf-yang-metadata\" name=\"aa\">\n"
@@ -183,7 +183,7 @@
             "</md:annotation></module>";
     assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YIN, NULL));
     CHECK_LOG_CTX("Duplicate keyword \"type\".",
-            "/aa:{extension='md:annotation'}/aa");
+            "Path \"/aa:{extension='md:annotation'}/aa\".");
 
     /* duplication of the same annotation */
     data = "<module xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\" xmlns:md=\"urn:ietf:params:xml:ns:yang:ietf-yang-metadata\" name=\"aa\">\n"
@@ -196,7 +196,7 @@
             "</md:annotation></module>";
     assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YIN, NULL));
     CHECK_LOG_CTX("Ext plugin \"ly2 metadata v1\": Extension md:annotation is instantiated multiple times.",
-            "/aa:{extension='md:annotation'}/aa");
+            "Path \"/aa:{extension='md:annotation'}/aa\".");
 }
 
 int
diff --git a/tests/utests/extensions/test_nacm.c b/tests/utests/extensions/test_nacm.c
index 1c999fb..5f7028e 100644
--- a/tests/utests/extensions/test_nacm.c
+++ b/tests/utests/extensions/test_nacm.c
@@ -58,7 +58,7 @@
     assert_int_equal(LY_SUCCESS, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YANG, NULL));
     CHECK_LOG_CTX("Ext plugin \"ly2 NACM v1\": "
             "Extension nacm:default-deny-all is allowed only in a data nodes, but it is placed in \"module\" statement.",
-            "/b:{extension='nacm:default-deny-all'}");
+            "Path \"/b:{extension='nacm:default-deny-all'}\".");
 
     /* invalid */
     data = "module aa {yang-version 1.1; namespace urn:tests:extensions:nacm:aa; prefix en;"
@@ -67,7 +67,7 @@
     assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YANG, NULL));
     CHECK_LOG_CTX("Ext plugin \"ly2 NACM v1\": "
             "Extension nacm:default-deny-write is mixed with nacm:default-deny-all.",
-            "/aa:l/{extension='nacm:default-deny-all'}");
+            "Path \"/aa:l/{extension='nacm:default-deny-all'}\".");
 }
 
 static void
@@ -100,7 +100,7 @@
     assert_int_equal(LY_SUCCESS, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YANG, NULL));
     CHECK_LOG_CTX("Ext plugin \"ly2 NACM v1\": "
             "Extension nacm:default-deny-write is not allowed in notification statement.",
-            "/b:notif/{extension='nacm:default-deny-write'}");
+            "Path \"/b:notif/{extension='nacm:default-deny-write'}\".");
 
     /* invalid */
     data = "module aa {yang-version 1.1; namespace urn:tests:extensions:nacm:aa; prefix en;"
@@ -109,7 +109,7 @@
     assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YANG, NULL));
     CHECK_LOG_CTX("Ext plugin \"ly2 NACM v1\": "
             "Extension nacm:default-deny-write is instantiated multiple times.",
-            "/aa:l/{extension='nacm:default-deny-write'}");
+            "Path \"/aa:l/{extension='nacm:default-deny-write'}\".");
 }
 
 int
diff --git a/tests/utests/extensions/test_schema_mount.c b/tests/utests/extensions/test_schema_mount.c
index d11eeaf..17a4c94 100644
--- a/tests/utests/extensions/test_schema_mount.c
+++ b/tests/utests/extensions/test_schema_mount.c
@@ -75,7 +75,7 @@
     assert_int_equal(LY_EINVAL, lys_parse_mem(UTEST_LYCTX, schema, LYS_IN_YANG, NULL));
     CHECK_LOG_CTX("Ext plugin \"ly2 schema mount v1\": "
             "Extension \"yangmnt:mount-point\" instance not allowed in YANG version 1 module.",
-            "/sm:root/{extension='yangmnt:mount-point'}/root");
+            "Path \"/sm:root/{extension='yangmnt:mount-point'}/root\".");
 
     schema =
             "module sm {\n"
@@ -92,7 +92,7 @@
     assert_int_equal(LY_EINVAL, lys_parse_mem(UTEST_LYCTX, schema, LYS_IN_YANG, NULL));
     CHECK_LOG_CTX("Ext plugin \"ly2 schema mount v1\": "
             "Extension \"yangmnt:mount-point\" instance allowed only in container or list statement.",
-            "/sm:{extension='yangmnt:mount-point'}/root");
+            "Path \"/sm:{extension='yangmnt:mount-point'}/root\".");
 
     schema =
             "module sm {\n"
@@ -114,7 +114,7 @@
     assert_int_equal(LY_EINVAL, lys_parse_mem(UTEST_LYCTX, schema, LYS_IN_YANG, NULL));
     CHECK_LOG_CTX("Ext plugin \"ly2 schema mount v1\": "
             "Extension \"yangmnt:mount-point\" instance allowed only in container or list statement.",
-            "/sm:root/l/{extension='yangmnt:mount-point'}/root");
+            "Path \"/sm:root/l/{extension='yangmnt:mount-point'}/root\".");
 
     schema =
             "module sm {\n"
@@ -138,7 +138,7 @@
     assert_int_equal(LY_EINVAL, lys_parse_mem(UTEST_LYCTX, schema, LYS_IN_YANG, NULL));
     CHECK_LOG_CTX("Ext plugin \"ly2 schema mount v1\": "
             "Multiple extension \"yangmnt:mount-point\" instances.",
-            "/sm:l/{extension='yangmnt:mount-point'}/root");
+            "Path \"/sm:l/{extension='yangmnt:mount-point'}/root\".");
 
     /* valid */
     schema =
@@ -410,25 +410,25 @@
     CHECK_PARSE_LYD_PARAM(xml, LYD_XML, LYD_PARSE_STRICT, LYD_VALIDATE_PRESENT, LY_EVALID, data);
     CHECK_LOG_CTX("Ext plugin \"ly2 schema mount v1\": "
             "Mandatory node \"type\" instance does not exist.",
-            "Schema location \"/ietf-interfaces:interfaces/interface/type\".");
+            "Data location \"/ietf-interfaces:interfaces/interface[name='bu']\".");
     CHECK_PARSE_LYD_PARAM(json, LYD_JSON, LYD_PARSE_STRICT, LYD_VALIDATE_PRESENT, LY_EVALID, data);
     CHECK_LOG_CTX("Ext plugin \"ly2 schema mount v1\": "
             "Mandatory node \"type\" instance does not exist.",
-            "Schema location \"/ietf-interfaces:interfaces/interface/type\".");
+            "Data location \"/ietf-interfaces:interfaces/interface[name='bu']\".");
 
     /* same validation fail in separate validation */
     CHECK_PARSE_LYD_PARAM(xml, LYD_XML, LYD_PARSE_STRICT | LYD_PARSE_ONLY, 0, LY_SUCCESS, data);
     assert_int_equal(LY_EVALID, lyd_validate_all(&data, NULL, LYD_VALIDATE_PRESENT, NULL));
     CHECK_LOG_CTX("Ext plugin \"ly2 schema mount v1\": "
             "Mandatory node \"type\" instance does not exist.",
-            "Schema location \"/ietf-interfaces:interfaces/interface/type\".");
+            "Data location \"/ietf-interfaces:interfaces/interface[name='bu']\".");
     lyd_free_siblings(data);
 
     CHECK_PARSE_LYD_PARAM(json, LYD_JSON, LYD_PARSE_STRICT | LYD_PARSE_ONLY, 0, LY_SUCCESS, data);
     assert_int_equal(LY_EVALID, lyd_validate_all(&data, NULL, LYD_VALIDATE_PRESENT, NULL));
     CHECK_LOG_CTX("Ext plugin \"ly2 schema mount v1\": "
             "Mandatory node \"type\" instance does not exist.",
-            "Schema location \"/ietf-interfaces:interfaces/interface/type\".");
+            "Data location \"/ietf-interfaces:interfaces/interface[name='bu']\".");
     lyd_free_siblings(data);
 
     /* success */
@@ -878,7 +878,7 @@
     CHECK_PARSE_LYD_PARAM(xml, LYD_XML, LYD_PARSE_STRICT, LYD_VALIDATE_PRESENT, LY_EVALID, data);
     CHECK_LOG_CTX("Ext plugin \"ly2 schema mount v1\": "
             "Shared-schema yang-library content-id \"2\" differs from \"1\" used previously.",
-            "/ietf-yang-library:yang-library/content-id");
+            "Path \"/ietf-yang-library:yang-library/content-id\".");
 
     /* data for 2 mount points */
     ly_ctx_set_ext_data_clb(UTEST_LYCTX, test_ext_data_clb,
diff --git a/tests/utests/extensions/test_structure.c b/tests/utests/extensions/test_structure.c
index 9b238a9..9bad7a7 100644
--- a/tests/utests/extensions/test_structure.c
+++ b/tests/utests/extensions/test_structure.c
@@ -148,7 +148,7 @@
             "sx:structure struct {import yang;}}";
     UTEST_INVALID_MODULE(data, LYS_IN_YANG, NULL, LY_EVALID);
     CHECK_LOG_CTX("Invalid keyword \"import\" as a child of \"sx:structure struct\" extension instance.",
-            "/a:{extension='sx:structure'}/struct");
+            "Path \"/a:{extension='sx:structure'}/struct\".");
 
     data = "module a {yang-version 1.1; namespace urn:tests:extensions:structure:a; prefix self;"
             "import ietf-yang-structure-ext {prefix sx;}"
@@ -156,7 +156,7 @@
     UTEST_INVALID_MODULE(data, LYS_IN_YANG, NULL, LY_EVALID);
     CHECK_LOG_CTX("Ext plugin \"ly2 structure v1\": "
             "Extension sx:structure must not be used as a non top-level statement in \"container\" statement.",
-            "/a:b/{extension='sx:structure'}/struct");
+            "Path \"/a:b/{extension='sx:structure'}/struct\".");
 
     data = "module a {yang-version 1.1; namespace urn:tests:extensions:structure:a; prefix self;"
             "import ietf-yang-structure-ext {prefix sx;}"
@@ -171,7 +171,7 @@
             "sx:structure struct { container y { leaf y {type string;}}}}";
     UTEST_INVALID_MODULE(data, LYS_IN_YANG, NULL, LY_EVALID);
     CHECK_LOG_CTX("Ext plugin \"ly2 structure v1\": Extension sx:structure is instantiated multiple times.",
-            "/a:{extension='sx:structure'}/struct");
+            "Path \"/a:{extension='sx:structure'}/struct\".");
 
     data = "module a {yang-version 1.1; namespace urn:tests:extensions:structure:a; prefix self;"
             "import ietf-yang-structure-ext {prefix sx;}"
@@ -179,7 +179,7 @@
             "choice struct { container y { leaf y {type string;}}}}";
     UTEST_INVALID_MODULE(data, LYS_IN_YANG, NULL, LY_EVALID);
     CHECK_LOG_CTX("Ext plugin \"ly2 structure v1\": Extension sx:structure collides with a choice with the same identifier.",
-            "/a:{extension='sx:structure'}/struct");
+            "Path \"/a:{extension='sx:structure'}/struct\".");
 
     /* augment-structure */
     data = "module a {yang-version 1.1; namespace urn:tests:extensions:structure:a; prefix a;"
@@ -199,7 +199,7 @@
             "}}";
     UTEST_INVALID_MODULE(data, LYS_IN_YANG, NULL, LY_ENOTFOUND);
     CHECK_LOG_CTX("Augment extension target node \"/a:n1\" from module \"b\" was not found.",
-            "/b:{extension='sx:augment-structure'}/{augment='/a:n1'}");
+            "Path \"/b:{extension='sx:augment-structure'}/{augment='/a:n1'}\".");
 }
 
 static void
diff --git a/tests/utests/extensions/test_yangdata.c b/tests/utests/extensions/test_yangdata.c
index 89d3231..57caaf2 100644
--- a/tests/utests/extensions/test_yangdata.c
+++ b/tests/utests/extensions/test_yangdata.c
@@ -119,7 +119,7 @@
     assert_null(mod->compiled->exts);
     CHECK_LOG_CTX("Ext plugin \"ly2 yang-data v1\": "
             "Extension rc:yang-data is ignored since it appears as a non top-level statement in \"container\" statement.",
-            "/b:b/{extension='rc:yang-data'}/template");
+            "Path \"/b:b/{extension='rc:yang-data'}/template\".");
     assert_int_equal(LY_SUCCESS, lys_print_mem(&printed, mod, LYS_OUT_YANG_COMPILED, 0));
     assert_string_equal(printed, info);
     free(printed);
@@ -168,7 +168,7 @@
 
     assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YANG, NULL));
     CHECK_LOG_CTX("Invalid keyword \"leaf\" as a child of \"rc:yang-data template\" extension instance.",
-            "/a:{extension='rc:yang-data'}/template");
+            "Path \"/a:{extension='rc:yang-data'}/template\".");
 
     data = "module a {yang-version 1.1; namespace urn:tests:extensions:yangdata:a; prefix self;"
             "import ietf-restconf {revision-date 2017-01-26; prefix rc;}"
@@ -177,7 +177,7 @@
     CHECK_LOG_CTX("Ext plugin \"ly2 yang-data v1\": "
             "Extension rc:yang-data is instantiated with leaf top level data node (inside a choice), "
             "but only a single container data node is allowed.",
-            "/a:{extension='rc:yang-data'}/template");
+            "Path \"/a:{extension='rc:yang-data'}/template\".");
 
     data = "module a {yang-version 1.1; namespace urn:tests:extensions:yangdata:a; prefix self;"
             "import ietf-restconf {revision-date 2017-01-26; prefix rc;}"
@@ -186,7 +186,7 @@
     CHECK_LOG_CTX("Ext plugin \"ly2 yang-data v1\": "
             "Extension rc:yang-data is instantiated with multiple top level data nodes (inside a single choice's case), "
             "but only a single container data node is allowed.",
-            "/a:{extension='rc:yang-data'}/template");
+            "Path \"/a:{extension='rc:yang-data'}/template\".");
 
     data = "module a {yang-version 1.1; namespace urn:tests:extensions:yangdata:a; prefix self;"
             "import ietf-restconf {revision-date 2017-01-26; prefix rc;}"
@@ -195,7 +195,7 @@
     CHECK_LOG_CTX("Ext plugin \"ly2 yang-data v1\": "
             "Extension rc:yang-data is instantiated with multiple top level data nodes, "
             "but only a single container data node is allowed.",
-            "/a:{extension='rc:yang-data'}/template");
+            "Path \"/a:{extension='rc:yang-data'}/template\".");
 
     data = "module a {yang-version 1.1; namespace urn:tests:extensions:yangdata:a; prefix self;"
             "import ietf-restconf {revision-date 2017-01-26; prefix rc;}"
@@ -204,7 +204,7 @@
     CHECK_LOG_CTX("Ext plugin \"ly2 yang-data v1\": "
             "Extension rc:yang-data is instantiated without any top level data node, "
             "but exactly one container data node is expected.",
-            "/a:{extension='rc:yang-data'}/template");
+            "Path \"/a:{extension='rc:yang-data'}/template\".");
 
     data = "module a {yang-version 1.1; namespace urn:tests:extensions:yangdata:a; prefix self;"
             "import ietf-restconf {revision-date 2017-01-26; prefix rc;}"
@@ -220,7 +220,7 @@
     assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YANG, NULL));
     CHECK_LOG_CTX("Ext plugin \"ly2 yang-data v1\": "
             "Extension rc:yang-data is instantiated multiple times.",
-            "/a:{extension='rc:yang-data'}/template");
+            "Path \"/a:{extension='rc:yang-data'}/template\".");
 
     data = "module a {yang-version 1.1; namespace urn:tests:extensions:yangdata:a; prefix self;"
             "import ietf-restconf {revision-date 2017-01-26; prefix rc;}"
@@ -230,7 +230,7 @@
     CHECK_LOG_CTX("Ext plugin \"ly2 yang-data v1\": "
             "Extension rc:yang-data is instantiated with leaf-list top level data node, "
             "but only a single container data node is allowed.",
-            "/a:{extension='rc:yang-data'}/template");
+            "Path \"/a:{extension='rc:yang-data'}/template\".");
 }
 
 static void