log UPDATE always log the schema node if fits

Refs #1932
diff --git a/src/log.c b/src/log.c
index 4d5fd3c..915b6e5 100644
--- a/src/log.c
+++ b/src/log.c
@@ -597,18 +597,19 @@
         /* data/schema node */
         if (log_location.dnodes.count) {
             dnode = log_location.dnodes.objs[log_location.dnodes.count - 1];
-            if (!dnode->parent && lysc_data_parent(dnode->schema) && (log_location.dnodes.count > 1)) {
+            if (dnode->parent || !lysc_data_parent(dnode->schema)) {
+                /* data node with all of its parents */
+                str = lyd_path(log_location.dnodes.objs[log_location.dnodes.count - 1], LYD_PATH_STD, NULL, 0);
+                LY_CHECK_ERR_RET(!str, LOGMEM(ctx), LY_EMEM);
+            } else {
                 /* data parsers put all the parent nodes in the set, but they are not connected */
                 str = lyd_path_set(&log_location.dnodes, LYD_PATH_STD);
                 LY_CHECK_ERR_RET(!str, LOGMEM(ctx), LY_EMEM);
+            }
 
-                /* sometimes the last node is not created yet and we only have the schema node */
-                if (log_location.scnodes.count) {
-                    ly_vlog_build_path_append(&str, log_location.scnodes.objs[log_location.scnodes.count - 1], dnode);
-                }
-            } else {
-                str = lyd_path(log_location.dnodes.objs[log_location.dnodes.count - 1], LYD_PATH_STD, NULL, 0);
-                LY_CHECK_ERR_RET(!str, LOGMEM(ctx), LY_EMEM);
+            /* sometimes the last node is not created yet and we only have the schema node */
+            if (log_location.scnodes.count) {
+                ly_vlog_build_path_append(&str, log_location.scnodes.objs[log_location.scnodes.count - 1], dnode);
             }
 
             r = asprintf(path, "Data location \"%s\"", str);
diff --git a/tests/utests/data/test_parser_json.c b/tests/utests/data/test_parser_json.c
index a44e6b6..3dd5eb4 100644
--- a/tests/utests/data/test_parser_json.c
+++ b/tests/utests/data/test_parser_json.c
@@ -532,7 +532,7 @@
     data = "{\"a:l1\":[{\"a\":\"val_a\",\"b\":\"val_b\",\"c\":\"val_c\"}]}";
     PARSER_CHECK_ERROR(data, 0, LYD_VALIDATE_PRESENT, tree, LY_EVALID,
             "Invalid non-number-encoded int16 value \"val_c\".",
-            "Data location \"/a:l1[a='val_a'][b='val_b']\", line number 1.");
+            "Data location \"/a:l1[a='val_a'][b='val_b']/c\", line number 1.");
 
     /* opaq flag */
     CHECK_PARSE_LYD(data, LYD_PARSE_OPAQ | LYD_PARSE_ONLY, 0, tree);
diff --git a/tests/utests/data/test_parser_xml.c b/tests/utests/data/test_parser_xml.c
index 271cc4b..86b926b 100644
--- a/tests/utests/data/test_parser_xml.c
+++ b/tests/utests/data/test_parser_xml.c
@@ -284,7 +284,7 @@
             "</l1>\n";
     PARSER_CHECK_ERROR(data, 0, LYD_VALIDATE_PRESENT, tree, LY_EVALID,
             "Invalid type int16 value \"val_c\".",
-            "Data location \"/a:l1[a='val_a'][b='val_b']\", line number 4.");
+            "Data location \"/a:l1[a='val_a'][b='val_b']/c\", line number 4.");
 
     /* opaq flag */
     CHECK_PARSE_LYD(data, LYD_PARSE_OPAQ | LYD_PARSE_ONLY, 0, tree);
diff --git a/tests/utests/data/test_validation.c b/tests/utests/data/test_validation.c
index b8e4b03..415e16a 100644
--- a/tests/utests/data/test_validation.c
+++ b/tests/utests/data/test_validation.c
@@ -1095,7 +1095,7 @@
             "</cont>\n";
     CHECK_PARSE_LYD_PARAM(data, LYD_XML, LYD_PARSE_ONLY | LYD_PARSE_NO_STATE, 0, LY_EVALID, tree);
     CHECK_LOG_CTX("Unexpected data state node \"cont2\" found.",
-            "Data location \"/h:cont\", line number 3.");
+            "Data location \"/h:cont/cont2\", line number 3.");
 
     CHECK_PARSE_LYD_PARAM(data, LYD_XML, LYD_PARSE_ONLY, 0, LY_SUCCESS, tree);
     assert_int_equal(LY_EVALID, lyd_validate_all(&tree, NULL, LYD_VALIDATE_PRESENT | LYD_VALIDATE_NO_STATE, NULL));
@@ -1293,7 +1293,7 @@
     assert_int_equal(LY_SUCCESS, ly_in_new_memory(data, &in));
     assert_int_equal(LY_EVALID, lyd_parse_op(UTEST_LYCTX, NULL, in, LYD_XML, LYD_TYPE_RPC_YANG, &tree, NULL));
     CHECK_LOG_CTX("Unsatisfied length - string \"123\" length is not allowed.",
-            "Data location \"/val-str:modify-user-password\", line number 3.");
+            "Data location \"/val-str:modify-user-password/new-password\", line number 3.");
     ly_in_free(in, 0);
 }