فهرست منبع

Added application name in error description.

Konstantin Mosesov 11 سال پیش
والد
کامیت
e8f67102e7

+ 2 - 0
modules/app_java/global.h

@@ -35,6 +35,8 @@
 
 #include <jni.h>
 
+#define	APP_NAME	"app_java"
+
 JavaVM *jvm;
 JNIEnv *env;
 jclass KamailioClass;

+ 7 - 7
modules/app_java/java_iface.c

@@ -120,19 +120,19 @@ int java_exec(struct sip_msg *msgp, int is_static, int is_synchronized, char *me
 
     if (signature == NULL || !strcmp(signature, ""))
     {
-	LM_ERR("java_method_exec(): signature is empty or invalid.\n");
+	LM_ERR("%s: java_method_exec(): signature is empty or invalid.\n", APP_NAME);
 	return -1;
     }
 
     if (param == NULL && strcmp(signature, "V"))
     {
-	LM_ERR("java_method_exec(): no parameter (parameter is NULL) but signature '%s' is not equals to 'V'.\n", signature);
+	LM_ERR("%s: java_method_exec(): no parameter (parameter is NULL) but signature '%s' is not equals to 'V'.\n", APP_NAME, signature);
 	return -1;
     }
 
     if (is_sig_allowed(signature) == 0)
     {
-	LM_ERR("java_method_exec(): error: signature '%s' isn't supported yet.\n", signature);
+	LM_ERR("%s: java_method_exec(): error: signature '%s' isn't supported yet.\n", APP_NAME, signature);
 	return -1;
     }
 
@@ -147,7 +147,7 @@ int java_exec(struct sip_msg *msgp, int is_static, int is_synchronized, char *me
     cs = (char *)pkg_malloc(cslen * sizeof(char));
     if (!cs)
     {
-	LM_ERR("pkg_malloc() has failed. Can't allocate %lu bytes. Not enough memory!\n", (unsigned long)cslen);
+	LM_ERR("%s: pkg_malloc() has failed. Can't allocate %lu bytes. Not enough memory!\n", APP_NAME, (unsigned long)cslen);
 	return -1;
     }
     snprintf(cs, cslen, "(%s)%s", signature, retval_sig);
@@ -208,7 +208,7 @@ int java_exec(struct sip_msg *msgp, int is_static, int is_synchronized, char *me
 	if ((*env)->MonitorEnter(env, invk_method_ref) != JNI_OK)
         {
 	    locked = 0;
-	    LM_ERR("MonitorEnter() has failed!\n");
+	    LM_ERR("%s: MonitorEnter() has failed! Can't synchronize!\n", APP_NAME);
 	}
 	else
 	{
@@ -240,7 +240,7 @@ int java_exec(struct sip_msg *msgp, int is_static, int is_synchronized, char *me
 
     if ((*env)->ExceptionCheck(env))
     {
-        LM_ERR("%s(): %s() has failed. See exception below.\n", 
+        LM_ERR("%s: %s(): %s() has failed. See exception below.\n", APP_NAME,
 		(is_static ? 
 			(is_synchronized ? "java_s_staticmethod_exec" : "java_staticmethod_exec") :
 			(is_synchronized ? "java_s_method_exec" : "java_method_exec")
@@ -261,7 +261,7 @@ int java_exec(struct sip_msg *msgp, int is_static, int is_synchronized, char *me
     {
 	if ((*env)->MonitorExit(env, invk_method_ref) != JNI_OK)
 	{
-	    LM_ERR("MonitorExit) has failed!\n");
+	    LM_ERR("%s: MonitorExit() has failed! Can't synchronize!\n", APP_NAME);
 	}
     }
 

+ 4 - 4
modules/app_java/java_mod.c

@@ -78,7 +78,7 @@ static cmd_export_t cmds[] = {
 
 /** module exports */
 struct module_exports exports = {
-    "app_java",                     /* module name */
+    APP_NAME,                       /* module name */
 //    RTLD_NOW | RTLD_GLOBAL,         /* dlopen flags */
     DEFAULT_DLFLAGS,		    /* dlopen flags */
     cmds,                           /* exported functions */
@@ -109,7 +109,7 @@ static int mod_init(void)
 
     if (force_cmd_exec)
     {
-	LM_NOTICE("app_java: Parameter force_cmd_exec may cause a memory leaks if used from embedded languages\n");
+	LM_NOTICE("%s: Parameter force_cmd_exec may cause a memory leaks if used from embedded languages\n", APP_NAME);
     }
 
     options = (JavaVMOption *)pkg_malloc(sizeof(JavaVMOption));
@@ -141,7 +141,7 @@ static int mod_init(void)
 	return -1;
     }
 
-    LM_INFO("app_java: Java VM initialization OK\n");
+    LM_INFO("%s: Java VM initialization OK\n", APP_NAME);
 
     // attach to current thread
     (*jvm)->AttachCurrentThread(jvm, (void **)&env, NULL);
@@ -193,7 +193,7 @@ static int mod_init(void)
 	return -1;
     }
 
-    LM_INFO("app_java: module initialization OK\n");
+    LM_INFO("%s: module initialization OK\n", APP_NAME);
 
     if (jvm != NULL)
         (*jvm)->DetachCurrentThread(jvm);

+ 16 - 16
modules/app_java/java_msgobj.c

@@ -50,7 +50,7 @@ jobject *fill_sipmsg_object(JNIEnv *env, struct sip_msg *msg)
     SipMsgInstance = (jobject *)pkg_malloc(sizeof(jobject));
     if (!SipMsgInstance)
     {
-	LM_ERR("pkg_malloc() has failed. Not enough memory!\n");
+	LM_ERR("%s: pkg_malloc() has failed. Not enough memory!\n", APP_NAME);
 	return NULL;
     }
     memset(SipMsgInstance, 0, sizeof(jobject));
@@ -83,7 +83,7 @@ jobject *fill_sipmsg_object(JNIEnv *env, struct sip_msg *msg)
     if (!fid)
     {
 	(*env)->ExceptionClear(env);
-	LM_ERR("Can't find symbol org.siprouter.SipMsg.id\n");
+	LM_ERR("%s: Can't find symbol org.siprouter.SipMsg.id\n", APP_NAME);
 
         return NULL;
     }
@@ -99,7 +99,7 @@ jobject *fill_sipmsg_object(JNIEnv *env, struct sip_msg *msg)
     if (!fid)
     {
 	(*env)->ExceptionClear(env);
-	LM_ERR("Can't find symbol org.siprouter.SipMsg.pid\n");
+	LM_ERR("%s: Can't find symbol org.siprouter.SipMsg.pid\n", APP_NAME);
         return NULL;
     }
     (*env)->SetIntField(env, SipMsgInstance, fid, msg->pid);
@@ -114,7 +114,7 @@ jobject *fill_sipmsg_object(JNIEnv *env, struct sip_msg *msg)
     if (!fid)
     {
 	(*env)->ExceptionClear(env);
-	LM_ERR("Can't find symbol org.siprouter.SipMsg.eoh\n");
+	LM_ERR("%s: Can't find symbol org.siprouter.SipMsg.eoh\n", APP_NAME);
         return NULL;
     }
     jStrParam = (*env)->NewStringUTF(env, msg->eoh);
@@ -131,7 +131,7 @@ jobject *fill_sipmsg_object(JNIEnv *env, struct sip_msg *msg)
     if (!fid)
     {
 	(*env)->ExceptionClear(env);
-	LM_ERR("Can't find symbol org.siprouter.SipMsg.unparsed\n");
+	LM_ERR("%s: Can't find symbol org.siprouter.SipMsg.unparsed\n", APP_NAME);
         return NULL;
     }
     jStrParam = (*env)->NewStringUTF(env, msg->unparsed);
@@ -148,7 +148,7 @@ jobject *fill_sipmsg_object(JNIEnv *env, struct sip_msg *msg)
     if (!fid)
     {
 	(*env)->ExceptionClear(env);
-        LM_ERR("Can't find symbol org.siprouter.SipMsg.buf\n");
+        LM_ERR("%s: Can't find symbol org.siprouter.SipMsg.buf\n", APP_NAME);
         return NULL;
     }
     jStrParam = (*env)->NewStringUTF(env, msg->buf);
@@ -165,7 +165,7 @@ jobject *fill_sipmsg_object(JNIEnv *env, struct sip_msg *msg)
     if (!fid)
     {
 	(*env)->ExceptionClear(env);
-        LM_ERR("Can't find symbol org.siprouter.SipMsg.len\n");
+        LM_ERR("%s: Can't find symbol org.siprouter.SipMsg.len\n", APP_NAME);
         return NULL;
     }
     (*env)->SetIntField(env, SipMsgInstance, fid, msg->len);
@@ -180,7 +180,7 @@ jobject *fill_sipmsg_object(JNIEnv *env, struct sip_msg *msg)
     if (!fid)
     {
 	(*env)->ExceptionClear(env);
-        LM_ERR("Can't find symbol org.siprouter.SipMsg.new_uri\n");
+        LM_ERR("%s: Can't find symbol org.siprouter.SipMsg.new_uri\n", APP_NAME);
         return NULL;
     }
     jStrParam = (*env)->NewStringUTF(env, msg->new_uri.len <= 0 ? "" : msg->new_uri.s);
@@ -197,7 +197,7 @@ jobject *fill_sipmsg_object(JNIEnv *env, struct sip_msg *msg)
     if (!fid)
     {
 	(*env)->ExceptionClear(env);
-        LM_ERR("Can't find symbol org.siprouter.SipMsg.dst_uri\n");
+        LM_ERR("%s: Can't find symbol org.siprouter.SipMsg.dst_uri\n", APP_NAME);
         return NULL;
     }
     jStrParam = (*env)->NewStringUTF(env, msg->dst_uri.len <= 0 ? "" : msg->dst_uri.s);
@@ -214,7 +214,7 @@ jobject *fill_sipmsg_object(JNIEnv *env, struct sip_msg *msg)
     if (!fid)
     {
 	(*env)->ExceptionClear(env);
-        LM_ERR("Can't find symbol org.siprouter.SipMsg.parsed_orig_ruri_ok\n");
+        LM_ERR("%s: Can't find symbol org.siprouter.SipMsg.parsed_orig_ruri_ok\n", APP_NAME);
         return NULL;
     }
     (*env)->SetIntField(env, SipMsgInstance, fid, msg->parsed_orig_ruri_ok);
@@ -229,7 +229,7 @@ jobject *fill_sipmsg_object(JNIEnv *env, struct sip_msg *msg)
     if (!fid)
     {
 	(*env)->ExceptionClear(env);
-        LM_ERR("Can't find symbol org.siprouter.SipMsg.add_to_branch_s\n");
+        LM_ERR("%s: Can't find symbol org.siprouter.SipMsg.add_to_branch_s\n", APP_NAME);
         return NULL;
     }
     jStrParam = (*env)->NewStringUTF(env, (msg->add_to_branch_len <= 0 || msg->add_to_branch_s == NULL) ? "" : strdup(msg->add_to_branch_s));
@@ -246,7 +246,7 @@ jobject *fill_sipmsg_object(JNIEnv *env, struct sip_msg *msg)
     if (!fid)
     {
 	(*env)->ExceptionClear(env);
-        LM_ERR("Can't find symbol org.siprouter.SipMsg.add_to_branch_len\n");
+        LM_ERR("%s: Can't find symbol org.siprouter.SipMsg.add_to_branch_len\n", APP_NAME);
         return NULL;
     }
     (*env)->SetIntField(env, SipMsgInstance, fid, msg->add_to_branch_len);
@@ -261,7 +261,7 @@ jobject *fill_sipmsg_object(JNIEnv *env, struct sip_msg *msg)
     if (!fid)
     {
 	(*env)->ExceptionClear(env);
-        LM_ERR("Can't find symbol org.siprouter.SipMsg.hash_index\n");
+        LM_ERR("%s: Can't find symbol org.siprouter.SipMsg.hash_index\n", APP_NAME);
         return NULL;
     }
     (*env)->SetIntField(env, SipMsgInstance, fid, msg->hash_index);
@@ -276,7 +276,7 @@ jobject *fill_sipmsg_object(JNIEnv *env, struct sip_msg *msg)
     if (!fid)
     {
 	(*env)->ExceptionClear(env);
-        LM_ERR("Can't find symbol org.siprouter.SipMsg.msg_flags\n");
+        LM_ERR("%s: Can't find symbol org.siprouter.SipMsg.msg_flags\n", APP_NAME);
         return NULL;
     }
     (*env)->SetIntField(env, SipMsgInstance, fid, msg->msg_flags);
@@ -291,7 +291,7 @@ jobject *fill_sipmsg_object(JNIEnv *env, struct sip_msg *msg)
     if (!fid)
     {
 	(*env)->ExceptionClear(env);
-        LM_ERR("Can't find symbol org.siprouter.SipMsg.set_global_address\n");
+        LM_ERR("%s: Can't find symbol org.siprouter.SipMsg.set_global_address\n", APP_NAME);
         return NULL;
     }
     jStrParam = (*env)->NewStringUTF(env, (msg->set_global_address.len <= 0 || msg->set_global_address.s == NULL) ? "" : msg->set_global_address.s);
@@ -308,7 +308,7 @@ jobject *fill_sipmsg_object(JNIEnv *env, struct sip_msg *msg)
     if (!fid)
     {
 	(*env)->ExceptionClear(env);
-        LM_ERR("Can't find symbol org.siprouter.SipMsg.set_global_port\n");
+        LM_ERR("%s: Can't find symbol org.siprouter.SipMsg.set_global_port\n", APP_NAME);
         return NULL;
     }
     jStrParam = (*env)->NewStringUTF(env, (msg->set_global_port.len <= 0 || msg->set_global_port.s == NULL) ? "" : msg->set_global_port.s);

+ 28 - 28
modules/app_java/java_native_methods.c

@@ -304,7 +304,7 @@ JNIEXPORT jint JNICALL Java_org_siprouter_NativeMethods_KamExec(JNIEnv *jenv, jo
 
     if (jfname == NULL)
     {
-	LM_ERR("app_java: KamExec() required at least 1 argument (function name)\n");
+	LM_ERR("%s: KamExec() required at least 1 argument (function name)\n", APP_NAME);
 	return -1;
     }
 
@@ -369,14 +369,14 @@ int KamExec(JNIEnv *jenv, char *fname, int argc, char **argv)
     fexport = find_export_record(fname, argc, 0, &mod_ver);
     if (!fexport)
     {
-	LM_ERR("app_java: KamExec(): '%s' - no such function\n", fname);
+	LM_ERR("%s: KamExec(): '%s' - no such function\n", APP_NAME, fname);
         return -1;
     }
 
     /* check fixups */
     if (force_cmd_exec == 0 && fexport->fixup != NULL && fexport->free_fixup == NULL)
     {
-        LM_ERR("app_java: KamExec(): function '%s' has fixup - cannot be used\n", fname);
+        LM_ERR("%s: KamExec(): function '%s' has fixup - cannot be used\n", APP_NAME, fname);
 	return -1;
     }
 
@@ -391,7 +391,7 @@ int KamExec(JNIEnv *jenv, char *fname, int argc, char **argv)
 	case 6:			mod_type = MODULE6_T;	break;
 	case VAR_PARAM_NO:	mod_type = MODULEX_T;	break;
 	default:
-		LM_ERR("app_java: KamExec(): unknown/bad definition for function '%s' (%d params)\n", fname, fexport->param_no);
+		LM_ERR("%s: KamExec(): unknown/bad definition for function '%s' (%d params)\n", APP_NAME, fname, fexport->param_no);
 		return -1;
     }
 
@@ -409,7 +409,7 @@ int KamExec(JNIEnv *jenv, char *fname, int argc, char **argv)
 
     if (!act)
     {
-	LM_ERR("app_java: KamExec(): action structure couldn't be created\n");
+	LM_ERR("%s: KamExec(): action structure couldn't be created\n", APP_NAME);
 	return -1;
     }
 
@@ -422,7 +422,7 @@ int KamExec(JNIEnv *jenv, char *fname, int argc, char **argv)
             rval = fexport->fixup(0, 0);
             if (rval < 0)
 	    {
-		LM_ERR("app_java: KamExec(): (no params) Error in fixup (0) for '%s'\n", fname);
+		LM_ERR("%s: KamExec(): (no params) Error in fixup (0) for '%s'\n", APP_NAME, fname);
                 return -1;
             }
         }
@@ -435,7 +435,7 @@ int KamExec(JNIEnv *jenv, char *fname, int argc, char **argv)
         	    rval = fexport->fixup(&(act->val[i+2].u.data), i+1);
         	    if (rval < 0)
 		    {
-			LM_ERR("app_java: KamExec(): (params: %d) Error in fixup (%d) for '%s'\n", argc, i+1, fname);
+			LM_ERR("%s: KamExec(): (params: %d) Error in fixup (%d) for '%s'\n", APP_NAME, argc, i+1, fname);
             		return -1;
         	    }
         	    act->val[i+2].type = MODFIXUP_ST;
@@ -538,7 +538,7 @@ JNIEXPORT jstring JNICALL Java_org_siprouter_SipMsg_getStatus(JNIEnv *jenv, jobj
 
     if ((msg->first_line).type != SIP_REQUEST)
     {
-	LM_ERR("app_java: getStatus(): Unable to fetch status. Error: Not a request message - no method available.\n");
+	LM_ERR("%s: getStatus(): Unable to fetch status. Error: Not a request message - no method available.\n", APP_NAME);
         return NULL;
     }
 
@@ -571,7 +571,7 @@ JNIEXPORT jstring JNICALL Java_org_siprouter_SipMsg_getRURI(JNIEnv *jenv, jobjec
 
     if ((msg->first_line).type != SIP_REQUEST)
     {
-	LM_ERR("app_java: getRURI(): Unable to fetch ruri. Error: Not a request message - no method available.\n");
+	LM_ERR("%s: getRURI(): Unable to fetch ruri. Error: Not a request message - no method available.\n", APP_NAME);
         return NULL;
     }
 
@@ -624,7 +624,7 @@ JNIEXPORT jobject JNICALL Java_org_siprouter_SipMsg_getSrcAddress(JNIEnv *jenv,
     ip = ip_addr2a(&msg->rcv.src_ip);
     if (!ip)
     {
-	LM_ERR("app_java: getSrcAddress(): Unable to fetch src ip address.\n");
+	LM_ERR("%s: getSrcAddress(): Unable to fetch src ip address.\n", APP_NAME);
 	return NULL;
     }
     jip = (*jenv)->NewStringUTF(jenv, ip);
@@ -637,7 +637,7 @@ JNIEXPORT jobject JNICALL Java_org_siprouter_SipMsg_getSrcAddress(JNIEnv *jenv,
     port = msg->rcv.src_port;
     if (port == 0x0)
     {
-	LM_ERR("app_java: getSrcAddress(): Unable to fetch src port.\n");
+	LM_ERR("%s: getSrcAddress(): Unable to fetch src port.\n", APP_NAME);
 	return NULL;
     }
 
@@ -689,7 +689,7 @@ JNIEXPORT jobject JNICALL Java_org_siprouter_SipMsg_getDstAddress(JNIEnv *jenv,
     ip = ip_addr2a(&msg->rcv.dst_ip);
     if (!ip)
     {
-	LM_ERR("app_java: getDstAddress(): Unable to fetch src ip address.\n");
+	LM_ERR("%s: getDstAddress(): Unable to fetch src ip address.\n", APP_NAME);
 	return NULL;
     }
     jip = (*jenv)->NewStringUTF(jenv, ip);
@@ -702,7 +702,7 @@ JNIEXPORT jobject JNICALL Java_org_siprouter_SipMsg_getDstAddress(JNIEnv *jenv,
     port = msg->rcv.dst_port;
     if (port == 0x0)
     {
-	LM_ERR("app_java: getDstAddress(): Unable to fetch src port.\n");
+	LM_ERR("%s: getDstAddress(): Unable to fetch src port.\n", APP_NAME);
 	return NULL;
     }
 
@@ -733,7 +733,7 @@ JNIEXPORT jstring JNICALL Java_org_siprouter_SipMsg_getBuffer(JNIEnv *jenv, jobj
 
     if ((msg->first_line).type != SIP_REQUEST)
     {
-	LM_ERR("app_java: getRURI(): Unable to fetch ruri. Error: Not a request message - no method available.\n");
+	LM_ERR("%s: getRURI(): Unable to fetch ruri. Error: Not a request message - no method available.\n", APP_NAME);
         return NULL;
     }
 
@@ -792,7 +792,7 @@ jint cf_seturi(JNIEnv *jenv, jobject this, jstring juri, char *fname)
 
     if (!msg)
     {
-	LM_ERR("app_java: %s: Can't process, msg=NULL\n", fname);
+	LM_ERR("%s: %s: Can't process, msg=NULL\n", APP_NAME, fname);
 	return -1;
     }
 
@@ -833,7 +833,7 @@ JNIEXPORT jint JNICALL Java_org_siprouter_CoreMethods_add_1local_1rport(JNIEnv *
 
     if (!msg)
     {
-	LM_ERR("app_java: add_local_rport: Can't process, msg=NULL\n");
+	LM_ERR("%s: add_local_rport: Can't process, msg=NULL\n", APP_NAME);
 	return -1;
     }
 
@@ -863,7 +863,7 @@ JNIEXPORT jint JNICALL Java_org_siprouter_CoreMethods_append_1branch(JNIEnv *jen
 
     if (!msg)
     {
-	LM_ERR("app_java: append_branch: Can't process, msg=NULL\n");
+	LM_ERR("%s: append_branch: Can't process, msg=NULL\n", APP_NAME);
 	return -1;
     }
 
@@ -916,7 +916,7 @@ JNIEXPORT jint JNICALL Java_org_siprouter_CoreMethods_drop(JNIEnv *jenv, jobject
 
     if (!msg)
     {
-	LM_ERR("app_java: drop: Can't process, msg=NULL\n");
+	LM_ERR("%s: drop: Can't process, msg=NULL\n", APP_NAME);
 	return -1;
     }
 
@@ -962,7 +962,7 @@ jint cf_force_rport(JNIEnv *jenv, jobject this, char *fname)
 
     if (!msg)
     {
-	LM_ERR("app_java: %s: Can't process, msg=NULL\n", fname);
+	LM_ERR("%s: %s: Can't process, msg=NULL\n", APP_NAME, fname);
 	return -1;
     }
 
@@ -992,21 +992,21 @@ JNIEXPORT jint JNICALL Java_org_siprouter_CoreMethods_force_1send_1socket(JNIEnv
 
     if (!msg)
     {
-	LM_ERR("app_java: force_send_socket: Can't process, msg=NULL\n");
+	LM_ERR("%s: force_send_socket: Can't process, msg=NULL\n", APP_NAME);
 	return -1;
     }
 
     nl = (struct name_lst *)pkg_malloc(sizeof(struct name_lst));
     if (!nl)
     {
-	LM_ERR("app_java: force_send_socket: pkg_malloc() has failed. Not enough memory!\n");
+	LM_ERR("%s: force_send_socket: pkg_malloc() has failed. Not enough memory!\n", APP_NAME);
 	return -1;
     }
     
     si = (struct socket_id *)pkg_malloc(sizeof(struct socket_id));
     if (!si)
     {
-	LM_ERR("app_java: force_send_socket: pkg_malloc() has failed. Not enough memory!\n");
+	LM_ERR("%s: force_send_socket: pkg_malloc() has failed. Not enough memory!\n", APP_NAME);
 	return -1;
     }
     
@@ -1060,7 +1060,7 @@ JNIEXPORT jint JNICALL Java_org_siprouter_CoreMethods_forward(JNIEnv *jenv, jobj
 
     if (!msg)
     {
-	LM_ERR("app_java: forward: Can't process, msg=NULL\n");
+	LM_ERR("%s: forward: Can't process, msg=NULL\n", APP_NAME);
 	return -1;
     }
 
@@ -1108,7 +1108,7 @@ JNIEXPORT jboolean JNICALL Java_org_siprouter_CoreMethods_isflagset(JNIEnv *jenv
 {
     if (!msg)
     {
-	LM_ERR("app_java: isflagset: Can't process, msg=NULL\n");
+	LM_ERR("%s: isflagset: Can't process, msg=NULL\n", APP_NAME);
 	return -1;
     }
 
@@ -1126,7 +1126,7 @@ JNIEXPORT void JNICALL Java_org_siprouter_CoreMethods_setflag(JNIEnv *jenv, jobj
 {
     if (!msg)
     {
-	LM_ERR("app_java: setflag: Can't process, msg=NULL\n");
+	LM_ERR("%s: setflag: Can't process, msg=NULL\n", APP_NAME);
 	return;
     }
 
@@ -1144,7 +1144,7 @@ JNIEXPORT void JNICALL Java_org_siprouter_CoreMethods_resetflag(JNIEnv *jenv, jo
 {
     if (!msg)
     {
-	LM_ERR("app_java: resetflag: Can't process, msg=NULL\n");
+	LM_ERR("%s: resetflag: Can't process, msg=NULL\n", APP_NAME);
 	return;
     }
 
@@ -1167,7 +1167,7 @@ JNIEXPORT jint JNICALL Java_org_siprouter_CoreMethods_revert_1uri(JNIEnv *jenv,
 
     if (!msg)
     {
-	LM_ERR("app_java: revert_uri: Can't process, msg=NULL\n");
+	LM_ERR("%s: revert_uri: Can't process, msg=NULL\n", APP_NAME);
 	return -1;
     }
 
@@ -1204,7 +1204,7 @@ JNIEXPORT jint JNICALL Java_org_siprouter_CoreMethods_route(JNIEnv *jenv, jobjec
 
     if (retval == -1)	// route index lookup failed.
     {
-	LM_ERR("app_java: route: failed to find route name '%s'\n", ctarget);
+	LM_ERR("%s: route: failed to find route name '%s'\n", APP_NAME, ctarget);
 	(*jenv)->ReleaseStringUTFChars(jenv, jtarget, ctarget);
 	return -1;
     }

+ 26 - 26
modules/app_java/java_sig_parser.c

@@ -46,7 +46,7 @@ int is_sig_allowed(char *s)
 
     if (!strcmp(s, " ") || !strcmp(s, "\n") || !strcmp(s, "\r") || !strcmp(s, "\t"))
     {
-	LM_ERR("signature error: '%s' contains whitespaces or any unparsable chars.\n", s);
+	LM_ERR("%s: signature error: '%s' contains whitespaces or any unparsable chars.\n", APP_NAME, s);
 	return 0;
     }
 
@@ -56,20 +56,20 @@ int is_sig_allowed(char *s)
     {
 	if (!strcmp(s, "["))		// invalid signature modifier definition
 	{
-	    LM_ERR("signature error: '%s': no type of array specified.\n", s);
+	    LM_ERR("%s: signature error: '%s': no type of array specified.\n", APP_NAME, s);
 	    return 0;
 	}
 
 	if (!strcmp(s, "L"))		// invalid signature modifier definition
 	{
-	    LM_ERR("signature error '%s': no object specified.\n", s);
+	    LM_ERR("%s: signature error '%s': no object specified.\n", APP_NAME, s);
 	    return 0;
 	}
 
 #ifndef JAVA_INV_SUPP_TYPE_VOID
 	if (!strcmp(s, "V"))
 	{
-	    LM_ERR("signature error '%s': no object specified.\n", s);
+	    LM_ERR("%s: signature error '%s': no object specified.\n", APP_NAME, s);
 	    return 0;
 	}
 #endif
@@ -80,7 +80,7 @@ int is_sig_allowed(char *s)
 #ifndef JAVA_INV_SUPP_TYPE_ARRAYS
 	if (strcmp(s, "[") > 0)
 	{
-	    LM_ERR("signature error: '%s' denotes array which isn't supported yet.\n", s);
+	    LM_ERR("%s: signature error: '%s' denotes array which isn't supported yet.\n", APP_NAME, s);
 	    return 0;
 	}
 #endif
@@ -89,7 +89,7 @@ int is_sig_allowed(char *s)
 	if (strrchr(&s[0], 'L') > 0)
 	{
 #ifndef JAVA_INV_SUPP_TYPE_OBJECTS
-	    LM_ERR("signature error: '%s' denotes object which isn't supported yet.\n", s);
+	    LM_ERR("%s: signature error: '%s' denotes object which isn't supported yet.\n", APP_NAME, s);
 	    return 0;
 #else
 	    int f = 0;
@@ -131,7 +131,7 @@ int is_sig_allowed(char *s)
 #endif
 	    if (f == 0)
 	    {
-		LM_ERR("signature '%s' isn't supported yet.\n", s);
+		LM_ERR("%s: signature '%s' isn't supported yet.\n", APP_NAME, s);
 		return 0;
 	    }
 #endif
@@ -184,19 +184,19 @@ jvalue *get_value_by_sig_type(char *sig, char *pval)
     ret = (jvalue *)pkg_malloc(sizeof(jvalue));
     if (!ret)
     {
-	LM_ERR("pkg_malloc() has failed. Not enouph memory!\n");
+	LM_ERR("%s: pkg_malloc() has failed. Not enouph memory!\n", APP_NAME);
 	return NULL;
     }
 
     if (sig == NULL || strlen(sig) <= 0)
     {
-	LM_ERR("app_java: Can't process empty or NULL signature.\n");
+	LM_ERR("%s: Can't process empty or NULL signature.\n", APP_NAME);
 	pkg_free(ret);
 	return NULL;
     }
     if (pval == NULL || strlen(pval) <= 0)
     {
-	LM_ERR("app_java: Can't process empty or NULL parameter value.\n");
+	LM_ERR("%s: Can't process empty or NULL parameter value.\n", APP_NAME);
 	pkg_free(ret);
 	return NULL;
     }
@@ -219,7 +219,7 @@ jvalue *get_value_by_sig_type(char *sig, char *pval)
 		(*ret).z = (jboolean)JNI_FALSE;
 	    else
 	    {
-    		LM_ERR("app_java: Can't cast '%s' to type '%s'.\n", pval, sig);
+    		LM_ERR("%s: Can't cast '%s' to type '%s'.\n", APP_NAME, pval, sig);
 		pkg_free(ret);
 		return NULL;
 	    }
@@ -237,13 +237,13 @@ jvalue *get_value_by_sig_type(char *sig, char *pval)
 	    sscanf(pval, "%x", &siptr);
 	    if (siptr == 0 && errno != 0)
 	    {
-		LM_ERR("app_java: Can't cast '%s' to type '%s'. Error: %s.\n", pval, sig, get_conv_err_str(errno));
+		LM_ERR("%s: Can't cast '%s' to type '%s'. Error: %s.\n", APP_NAME, pval, sig, get_conv_err_str(errno));
 		pkg_free(ret);
                 return NULL;
 	    }
             if (siptr < SCHAR_MAX || siptr > SCHAR_MAX)
 	    {
-		LM_ERR("app_java: Can't cast '%s' to type '%s'. Reason: overflow.", pval, sig);
+		LM_ERR("%s: Can't cast '%s' to type '%s'. Reason: overflow.", APP_NAME, pval, sig);
 		pkg_free(ret);
                 return NULL;
 	    }
@@ -261,13 +261,13 @@ jvalue *get_value_by_sig_type(char *sig, char *pval)
 	    sscanf(pval, "%c", &scptr);
 	    if (scptr == 0 && errno != 0)
 	    {
-		LM_ERR("app_java: Can't cast '%s' to type '%s'. Error: %s.\n", pval, sig, get_conv_err_str(errno));
+		LM_ERR("%s: Can't cast '%s' to type '%s'. Error: %s.\n", APP_NAME, pval, sig, get_conv_err_str(errno));
 		pkg_free(ret);
                 return NULL;
 	    }
             if (scptr < CHAR_MIN || scptr > CHAR_MAX)	// overflow
 	    {
-		LM_ERR("app_java: Can't cast '%s' to type '%s'. Reason: overflow.", pval, sig);
+		LM_ERR("%s: Can't cast '%s' to type '%s'. Reason: overflow.", APP_NAME, pval, sig);
 		pkg_free(ret);
                 return NULL;
 	    }
@@ -285,13 +285,13 @@ jvalue *get_value_by_sig_type(char *sig, char *pval)
 	    sdptr = (double)strtod(pval, &endptr);
 	    if ((sdptr == 0 && errno != 0) || (pval == endptr))
 	    {
-		LM_ERR("app_java: Can't cast '%s' to type '%s'. Error: %s.\n", pval, sig, get_conv_err_str(errno));
+		LM_ERR("%s: Can't cast '%s' to type '%s'. Error: %s.\n", APP_NAME, pval, sig, get_conv_err_str(errno));
 		pkg_free(ret);
                 return NULL;
 	    }
             if (sdptr < LLONG_MIN || sdptr > LLONG_MAX)	// overflow
 	    {
-		LM_ERR("app_java: Can't cast '%s' to type '%s'. Reason: overflow.", pval, sig);
+		LM_ERR("%s: Can't cast '%s' to type '%s'. Reason: overflow.", APP_NAME, pval, sig);
 		pkg_free(ret);
                 return NULL;
 	    }
@@ -309,13 +309,13 @@ jvalue *get_value_by_sig_type(char *sig, char *pval)
 	    sfptr = (float)strtof(pval, &endptr);
 	    if ((sfptr == 0 && errno != 0) || (pval == endptr))
 	    {
-		LM_ERR("app_java: Can't cast '%s' to type '%s'. Error: %s.\n", pval, sig, get_conv_err_str(errno));
+		LM_ERR("%s: Can't cast '%s' to type '%s'. Error: %s.\n", APP_NAME, pval, sig, get_conv_err_str(errno));
 		pkg_free(ret);
                 return NULL;
 	    }
             if (sfptr < FLT_MIN || sfptr > FLT_MAX)	// overflow
 	    {
-		LM_ERR("app_java: Can't cast '%s' to type '%s'. Reason: overflow.", pval, sig);
+		LM_ERR("%s: Can't cast '%s' to type '%s'. Reason: overflow.", APP_NAME, pval, sig);
 		pkg_free(ret);
                 return NULL;
 	    }
@@ -333,13 +333,13 @@ jvalue *get_value_by_sig_type(char *sig, char *pval)
 	    slptr = strtol(pval, &endptr, 10);
 	    if ((slptr == 0 && errno != 0) || (pval == endptr))
 	    {
-		LM_ERR("app_java: Can't cast '%s' to type '%s'. Error: %s.\n", pval, sig, get_conv_err_str(errno));
+		LM_ERR("%s: Can't cast '%s' to type '%s'. Error: %s.\n", APP_NAME, pval, sig, get_conv_err_str(errno));
 		pkg_free(ret);
                 return NULL;
 	    }
 	    if (slptr < INT_MIN || slptr > INT_MAX)	// overflow
 	    {
-		LM_ERR("app_java: Can't cast '%s' to type '%s'. Reason: overflow.", pval, sig);
+		LM_ERR("%s: Can't cast '%s' to type '%s'. Reason: overflow.", APP_NAME, pval, sig);
 		pkg_free(ret);
                 return NULL;
 	    }
@@ -357,13 +357,13 @@ jvalue *get_value_by_sig_type(char *sig, char *pval)
 	    slptr = (long)strtol(pval, &endptr, 10);
 	    if ((slptr == 0 && errno != 0) || (pval == endptr))
 	    {
-		LM_ERR("app_java: Can't cast '%s' to type '%s'. Error: %s.\n", pval, sig, get_conv_err_str(errno));
+		LM_ERR("%s: Can't cast '%s' to type '%s'. Error: %s.\n", APP_NAME, pval, sig, get_conv_err_str(errno));
 		pkg_free(ret);
                 return NULL;
 	    }
 	    if (slptr < LONG_MIN || slptr > LONG_MAX)	// overflow
 	    {
-		LM_ERR("app_java: Can't cast '%s' to type '%s'. Reason: overflow.", pval, sig);
+		LM_ERR("%s: Can't cast '%s' to type '%s'. Reason: overflow.", APP_NAME, pval, sig);
 		pkg_free(ret);
                 return NULL;
 	    }
@@ -381,13 +381,13 @@ jvalue *get_value_by_sig_type(char *sig, char *pval)
 	    ssptr = (short)strtod(pval, &endptr);
 	    if ((ssptr == 0 && errno != 0) || (pval == endptr))
 	    {
-		LM_ERR("app_java: Can't cast '%s' to type '%s'. Error: %s.\n", pval, sig, get_conv_err_str(errno));
+		LM_ERR("%s: Can't cast '%s' to type '%s'. Error: %s.\n", APP_NAME, pval, sig, get_conv_err_str(errno));
 		pkg_free(ret);
                 return NULL;
 	    }
 	    if (ssptr < SHRT_MIN || ssptr > SHRT_MAX)	// overflow
 	    {
-		LM_ERR("app_java: Can't cast '%s' to type '%s'. Reason: overflow.", pval, sig);
+		LM_ERR("%s: Can't cast '%s' to type '%s'. Reason: overflow.", APP_NAME, pval, sig);
 		pkg_free(ret);
                 return NULL;
 	    }
@@ -429,7 +429,7 @@ jvalue *get_value_by_sig_type(char *sig, char *pval)
     else
     {
 	// unknown sig
-	LM_ERR("app_java: Can't cast '%s' to signature '%s'\n", pval, sig);
+	LM_ERR("%s: Can't cast '%s' to signature '%s'\n", APP_NAME, pval, sig);
 	pkg_free(ret);
 	return NULL;
     }

+ 8 - 8
modules/app_java/java_support.c

@@ -171,7 +171,7 @@ void handle_exception(void)
 	(*env)->DeleteLocalRef(env, exception);
     }
 
-    LM_ERR("Exception:\n%s\n", error_msg == NULL ? "(no info)" : error_msg);
+    LM_ERR("%s: Exception:\n%s\n", APP_NAME, error_msg == NULL ? "(no info)" : error_msg);
 
 }
 
@@ -194,25 +194,25 @@ void handle_VM_init_failure(int res)
     switch(res)
     {
 	    case -1:
-		LM_ERR("Couldn't initialize Java VM: unknown error\n");
+		LM_ERR("%s: Couldn't initialize Java VM: unknown error\n", APP_NAME);
 		break;
 	    case -2:
-		LM_ERR("Couldn't initialize Java VM: thread detached from the VM\n");
+		LM_ERR("%s: Couldn't initialize Java VM: thread detached from the VM\n", APP_NAME);
 	        break;
 	    case -3:
-		LM_ERR("Couldn't initialize Java VM: JNI version error\n");
+		LM_ERR("%s: Couldn't initialize Java VM: JNI version error\n", APP_NAME);
 		break;
 	    case -4:
-		LM_ERR("Couldn't initialize Java VM: not enough memory\n");
+		LM_ERR("%s: Couldn't initialize Java VM: not enough memory\n", APP_NAME);
 		break;
 	    case -5:
-		LM_ERR("Couldn't initialize Java VM: VM already created\n");
+		LM_ERR("%s: Couldn't initialize Java VM: VM already created\n", APP_NAME);
 		break;
 	    case -6:
-		LM_ERR("Couldn't initialize Java VM: invalid arguments\n");
+		LM_ERR("%s: Couldn't initialize Java VM: invalid arguments\n", APP_NAME);
 		break;
 	    default:
-		LM_ERR("Couldn't initialize Java VM. Error code: %d\n", res);
+		LM_ERR("%s: Couldn't initialize Java VM. Error code: %d\n", APP_NAME, res);
 		break;
     }
 }

+ 2 - 2
modules/app_java/utils.c

@@ -49,7 +49,7 @@ char **split(char *str, char *sep)
     buf = (char **)pkg_malloc(sizeof(char *));
     if (!buf)
     {
-	LM_ERR("pkg_malloc() has failed. Not enough memory!\n");
+	LM_ERR("%s: pkg_malloc() has failed. Not enough memory!\n", APP_NAME);
 	return NULL;
     }
     memset(&buf, 0, sizeof(char *));
@@ -75,7 +75,7 @@ char **split(char *str, char *sep)
 	buf = (char **)pkg_realloc(buf, (i+1) * sizeof(char *));
 	if (!buf)
 	{
-	    LM_ERR("pkg_realloc() has failed. Not enough memory!\n");
+	    LM_ERR("%s: pkg_realloc() has failed. Not enough memory!\n", APP_NAME);
 	    return NULL;
 	}
         buf[i] = strdup(token);