Index: /pjproject/trunk/pjlib-util/src/pjlib-util/cli_telnet.c
===================================================================
--- /pjproject/trunk/pjlib-util/src/pjlib-util/cli_telnet.c	(revision 5980)
+++ /pjproject/trunk/pjlib-util/src/pjlib-util/cli_telnet.c	(revision 5981)
@@ -1786,5 +1786,5 @@
 
     if (status != PJ_SUCCESS) {
-	PJ_LOG(3, (THIS_FILE, "Failed setting socket options"));
+	PJ_PERROR(3, (THIS_FILE, status, "Failed setting socket options"));
     }
 
@@ -1821,5 +1821,5 @@
 	}
     } else {
-        PJ_LOG(3, (THIS_FILE, "Failed binding the socket"));
+        PJ_PERROR(3, (THIS_FILE, status, "Failed binding the socket"));
         goto on_exit;
     }
Index: /pjproject/trunk/pjlib-util/src/pjlib-util/dns_server.c
===================================================================
--- /pjproject/trunk/pjlib-util/src/pjlib-util/dns_server.c	(revision 5980)
+++ /pjproject/trunk/pjlib-util/src/pjlib-util/dns_server.c	(revision 5981)
@@ -472,5 +472,6 @@
 	char addrinfo[PJ_INET6_ADDRSTRLEN+10];
 	pj_sockaddr_print(src_addr, addrinfo, sizeof(addrinfo), 3);
-	PJ_LOG(4,(THIS_FILE, "Error parsing query from %s", addrinfo));
+	PJ_PERROR(4,(THIS_FILE, status, "Error parsing query from %s",
+		     addrinfo));
 	goto on_return;
     }
@@ -554,5 +555,5 @@
 				  0, src_addr, addr_len);
     if (status != PJ_SUCCESS && status != PJ_EPENDING) {
-	PJ_LOG(4,(THIS_FILE, "Error sending answer, status=%d", status));
+	PJ_PERROR(4,(THIS_FILE, status, "Error sending answer"));
 	goto on_return;
     }
Index: /pjproject/trunk/pjlib-util/src/pjlib-util/resolver.c
===================================================================
--- /pjproject/trunk/pjlib-util/src/pjlib-util/resolver.c	(revision 5980)
+++ /pjproject/trunk/pjlib-util/src/pjlib-util/resolver.c	(revision 5981)
@@ -1594,9 +1594,6 @@
 	} else {
 	    /* Error occurs */
-	    char errmsg[PJ_ERR_MSG_SIZE];
-
-	    pj_strerror(status, errmsg, sizeof(errmsg));
-	    PJ_LOG(4,(resolver->name.ptr,
-		      "Error transmitting request: %s", errmsg));
+	    PJ_PERROR(4,(resolver->name.ptr, status,
+			 "Error transmitting request"));
 
 	    /* Let it fallback to timeout section below */
@@ -1686,9 +1683,6 @@
     /* Check for errors */
     if (bytes_read < 0) {
-	char errmsg[PJ_ERR_MSG_SIZE];
-
 	status = (pj_status_t)-bytes_read;
-	pj_strerror(status, errmsg, sizeof(errmsg));
-	PJ_LOG(4,(resolver->name.ptr, "DNS resolver read error: %s", errmsg));
+	PJ_PERROR(4,(resolver->name.ptr, status, "DNS resolver read error"));
 
 	goto read_next_packet;
@@ -1727,12 +1721,8 @@
     /* Handle parse error */
     if (status != PJ_SUCCESS) {
-	char errmsg[PJ_ERR_MSG_SIZE];
-
-	pj_strerror(status, errmsg, sizeof(errmsg));
-	PJ_LOG(3,(resolver->name.ptr, 
-		  "Error parsing DNS response from %s:%d: %s", 
-		  pj_sockaddr_print(src_addr, addr, sizeof(addr), 2),
-		  pj_sockaddr_get_port(src_addr),
-		  errmsg));
+	PJ_PERROR(3,(resolver->name.ptr, status,
+		     "Error parsing DNS response from %s:%d", 
+		     pj_sockaddr_print(src_addr, addr, sizeof(addr), 2),
+		     pj_sockaddr_get_port(src_addr)));
 	goto read_next_packet;
     }
@@ -1815,9 +1805,6 @@
 
     if (status != PJ_EPENDING && status != PJ_ECANCELLED) {
-	char errmsg[PJ_ERR_MSG_SIZE];
-
-	pj_strerror(status, errmsg, sizeof(errmsg));	
-	PJ_LOG(4,(resolver->name.ptr, "DNS resolver ioqueue read error: %s",
-		  errmsg));
+	PJ_PERROR(4,(resolver->name.ptr, status,
+		     "DNS resolver ioqueue read error"));
 
 	pj_assert(!"Unhandled error");
Index: /pjproject/trunk/pjlib-util/src/pjlib-util/srv_resolver.c
===================================================================
--- /pjproject/trunk/pjlib-util/src/pjlib-util/srv_resolver.c	(revision 5980)
+++ /pjproject/trunk/pjlib-util/src/pjlib-util/srv_resolver.c	(revision 5981)
@@ -686,14 +686,9 @@
             status = pj_dns_parse_addr_response(pkt, &rec);
             if (status!=PJ_SUCCESS) {
-                char errmsg[PJ_ERR_MSG_SIZE];
-	        
-                PJ_LOG(4,(query_job->objname, 
-		          "DNS %s record parse error for '%.*s'."
-		          " Err=%d (%s)",
-                          (is_type_a ? "A" : "AAAA"),
-		          (int)query_job->domain_part.slen,
-		          query_job->domain_part.ptr,
-		          status,
-		          pj_strerror(status,errmsg,sizeof(errmsg)).ptr));
+                PJ_PERROR(4,(query_job->objname, status,
+			     "DNS %s record parse error for '%.*s'.",
+			     (is_type_a ? "A" : "AAAA"),
+			     (int)query_job->domain_part.slen,
+			     query_job->domain_part.ptr));
 	    }
 	}
@@ -756,15 +751,11 @@
 
 	} else if (status != PJ_SUCCESS) {
-	    char errmsg[PJ_ERR_MSG_SIZE];
-
 	    /* Update last error */
 	    query_job->last_error = status;
 
 	    /* Log error */
-	    pj_strerror(status, errmsg, sizeof(errmsg));
-	    PJ_LOG(4,(query_job->objname,
-		      "DNS %s record resolution failed: %s",
-		      (is_type_a? "A" : "AAAA"),
-		      errmsg));
+	    PJ_PERROR(4,(query_job->objname, status,
+			 "DNS %s record resolution failed",
+			 (is_type_a? "A" : "AAAA")));
 	}
 
@@ -841,14 +832,9 @@
     /* Check for failure */
     if (status != PJ_SUCCESS) {
-	char errmsg[PJ_ERR_MSG_SIZE];
-	PJ_UNUSED_ARG(errmsg);
-	PJ_LOG(4,(query_job->objname, 
-		  "DNS %s record resolution error for '%.*s'."
-		  " Err=%d (%s)",
-		  pj_dns_get_type_name(query_job->dns_state),
-		  (int)query_job->domain_part.slen,
-		  query_job->domain_part.ptr,
-		  status,
-		  pj_strerror(status,errmsg,sizeof(errmsg)).ptr));
+	PJ_PERROR(4,(query_job->objname, status,
+		     "DNS %s record resolution error for '%.*s'.",
+		     pj_dns_get_type_name(query_job->dns_state),
+		     (int)query_job->domain_part.slen,
+		     query_job->domain_part.ptr));
 
 	/* Cancel any pending query */
Index: /pjproject/trunk/pjlib-util/src/pjlib-util/stun_simple_client.c
===================================================================
--- /pjproject/trunk/pjlib-util/src/pjlib-util/stun_simple_client.c	(revision 5980)
+++ /pjproject/trunk/pjlib-util/src/pjlib-util/stun_simple_client.c	(revision 5981)
@@ -236,8 +236,6 @@
 
 		if (status != PJ_SUCCESS) {
-		    char errmsg[PJ_ERR_MSG_SIZE];
-
-		    PJ_LOG(4,(THIS_FILE, "recvfrom() error ignored: %s",
-			      pj_strerror(status, errmsg,sizeof(errmsg)).ptr));
+		    PJ_PERROR(4,(THIS_FILE, status,
+				 "recvfrom() error ignored"));
 
 		    /* Ignore non-PJ_SUCCESS status.
@@ -253,8 +251,6 @@
 		status = pjstun_parse_msg(recv_buf, len, &msg);
 		if (status != PJ_SUCCESS) {
-		    char errmsg[PJ_ERR_MSG_SIZE];
-
-		    PJ_LOG(4,(THIS_FILE, "STUN parsing error ignored: %s",
-			      pj_strerror(status, errmsg,sizeof(errmsg)).ptr));
+		    PJ_PERROR(4,(THIS_FILE, status,
+				 "STUN parsing error ignored"));
 
 		    /* Also ignore non-successful parsing. This may not
