Changed logging to include the file name and line number.

A logfile with "[debug] ../common/GSWUtil.c(165)" does not make much sense :-)
- GSWLog(GSW_WARNING,p_pLogServerData,
+ GSWLog(__FILE__, __LINE__, GSW_WARNING,p_pLogServerData,



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@24219 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
dwetzel 2006-12-19 22:41:28 +00:00
parent 6867f983dc
commit f576040019
13 changed files with 101 additions and 95 deletions

View file

@ -183,7 +183,7 @@ GSWeb_Init(server_rec *p_pServerRec,
pConfig=GSWeb_GetServerConfig(p_pServerRec); pConfig=GSWeb_GetServerConfig(p_pServerRec);
GSWLog_Init(NULL,GSW_INFO); GSWLog_Init(NULL,GSW_INFO);
GSWLog(GSW_INFO,p_pServerRec, GSWLog(__FILE__, __LINE__,GSW_INFO,p_pServerRec,
"GSWeb Init Start Config. Handler: " GSWEB_HANDLER); "GSWeb Init Start Config. Handler: " GSWEB_HANDLER);
GSWDebugLog(p_pServerRec, GSWDebugLog(p_pServerRec,
"GSWeb_Init: pConfig->pszGSWeb=%s", "GSWeb_Init: pConfig->pszGSWeb=%s",
@ -199,11 +199,11 @@ GSWeb_Init(server_rec *p_pServerRec,
g_szGSWeb_Conf_DocRoot, g_szGSWeb_Conf_DocRoot,
pConfig->pszRoot); pConfig->pszRoot);
*/ */
GSWLog(GSW_INFO,p_pServerRec, GSWLog(__FILE__, __LINE__,GSW_INFO,p_pServerRec,
"GSWeb Init LB Init. Handler: " GSWEB_HANDLER); "GSWeb Init LB Init. Handler: " GSWEB_HANDLER);
GSWConfig_Init(pDict,p_pServerRec); GSWConfig_Init(pDict,p_pServerRec);
GSWLog(GSW_INFO,p_pServerRec, GSWLog(__FILE__, __LINE__,GSW_INFO,p_pServerRec,
"GSWeb Init. Handler: " GSWEB_HANDLER); "GSWeb Init. Handler: " GSWEB_HANDLER);
GSWDict_Free(pDict); GSWDict_Free(pDict);
}; };
@ -302,7 +302,7 @@ GSWeb_Translation(request_rec *p_pRequestRec)
p_pRequestRec->server); p_pRequestRec->server);
if (eError!=GSWURLError_OK) if (eError!=GSWURLError_OK)
{ {
GSWLog(GSW_ERROR,p_pRequestRec->server, GSWLog(__FILE__, __LINE__,GSW_ERROR,p_pRequestRec->server,
"GSWeb_Translation Declined (Error %d)",(int)eError); "GSWeb_Translation Declined (Error %d)",(int)eError);
iRetValue=DECLINED; iRetValue=DECLINED;
} }
@ -618,7 +618,7 @@ dieWithMessage(request_rec *p_pRequestRec,
server_rec *pServerRec = p_pRequestRec->server; server_rec *pServerRec = p_pRequestRec->server;
GSWDebugLog(pServerRec,"Start dieWithMessage"); GSWDebugLog(pServerRec,"Start dieWithMessage");
GSWLog(GSW_ERROR,pServerRec,"Send Error Response: %s",p_pszMessage); GSWLog(__FILE__, __LINE__,GSW_ERROR,pServerRec,"Send Error Response: %s",p_pszMessage);
pResponse = GSWHTTPResponse_BuildErrorResponse(NULL, pResponse = GSWHTTPResponse_BuildErrorResponse(NULL,
p_pStats, p_pStats,
@ -669,7 +669,7 @@ GSWeb_Handler(request_rec *p_pRequestRec)
pConfig=GSWeb_GetServerConfig(p_pRequestRec->server); pConfig=GSWeb_GetServerConfig(p_pRequestRec->server);
// Log the request // Log the request
GSWLog(GSW_INFO, GSWLog(__FILE__, __LINE__,GSW_INFO,
pLogServerData, pLogServerData,
"GNUstepWeb New request: %s", "GNUstepWeb New request: %s",
p_pRequestRec->uri); p_pRequestRec->uri);
@ -687,7 +687,7 @@ GSWeb_Handler(request_rec *p_pRequestRec)
{ {
pszURLError=GSWURLErrorMessage(eError, pszURLError=GSWURLErrorMessage(eError,
pLogServerData); pLogServerData);
GSWLog(GSW_INFO,pLogServerData,"URL Parsing Error: %s", pszURLError); GSWLog(__FILE__, __LINE__,GSW_INFO,pLogServerData,"URL Parsing Error: %s", pszURLError);
if (eError==GSWURLError_InvalidAppName) if (eError==GSWURLError_InvalidAppName)
{ {
pResponse = GSWDumpConfigFile(&stStats, pResponse = GSWDumpConfigFile(&stStats,
@ -778,7 +778,7 @@ GSWeb_Handler(request_rec *p_pRequestRec)
iRemainingLength=0; iRemainingLength=0;
} }
}; };
GSWLog(GSW_INFO,pLogServerData,"pszBuffer(%p)=%.*s", GSWLog(__FILE__, __LINE__,GSW_INFO,pLogServerData,"pszBuffer(%p)=%.*s",
(void *)pszBuffer, (void *)pszBuffer,
(int)pRequest->uContentLength, (int)pRequest->uContentLength,
pszBuffer); pszBuffer);

View file

@ -60,12 +60,12 @@ void
GSWApp_Free(GSWApp *p_pApp) GSWApp_Free(GSWApp *p_pApp)
{ {
if (!p_pApp) if (!p_pApp)
GSWLog(GSW_CRITICAL,NULL,"No App to free"); GSWLog(__FILE__, __LINE__, GSW_CRITICAL,NULL,"No App to free");
else else
{ {
p_pApp->iUsageCounter--; p_pApp->iUsageCounter--;
if (p_pApp->iUsageCounter<0) if (p_pApp->iUsageCounter<0)
GSWLog(GSW_CRITICAL,NULL, GSWLog(__FILE__, __LINE__, GSW_CRITICAL,NULL,
"App seems to have been freed too much times"); "App seems to have been freed too much times");
if (p_pApp->iUsageCounter<=0) if (p_pApp->iUsageCounter<=0)
{ {
@ -90,17 +90,17 @@ GSWApp_AddInstance(GSWApp *p_pApp,
{ {
if (!p_pApp) if (!p_pApp)
{ {
GSWLog(GSW_CRITICAL,NULL,"No App to add instance"); GSWLog(__FILE__, __LINE__, GSW_CRITICAL,NULL,"No App to add instance");
} }
else if (!p_pInstance) else if (!p_pInstance)
{ {
GSWLog(GSW_CRITICAL,NULL,"No instance to add"); GSWLog(__FILE__, __LINE__, GSW_CRITICAL,NULL,"No instance to add");
} }
else else
{ {
if (p_pInstance->pApp!=p_pApp) if (p_pInstance->pApp!=p_pApp)
{ {
GSWLog(GSW_CRITICAL,NULL,"Trying to add instance to another app"); GSWLog(__FILE__, __LINE__, GSW_CRITICAL,NULL,"Trying to add instance to another app");
if (p_pInstance->pApp) if (p_pInstance->pApp)
p_pInstance->pApp->iUsageCounter--; p_pInstance->pApp->iUsageCounter--;
p_pInstance->pApp=p_pApp; p_pInstance->pApp=p_pApp;
@ -164,7 +164,7 @@ GSWAppInstance_New(GSWApp *p_pApp)
GSWAppInstance *pInstance=(GSWAppInstance*)calloc(1,sizeof(GSWAppInstance)); GSWAppInstance *pInstance=(GSWAppInstance*)calloc(1,sizeof(GSWAppInstance));
memset(pInstance,0,sizeof(GSWAppInstance)); memset(pInstance,0,sizeof(GSWAppInstance));
if (!p_pApp) if (!p_pApp)
GSWLog(GSW_CRITICAL,NULL,"Intance %p created without App", GSWLog(__FILE__, __LINE__, GSW_CRITICAL,NULL,"Intance %p created without App",
pInstance); pInstance);
pInstance->pApp=p_pApp; pInstance->pApp=p_pApp;
return pInstance; return pInstance;

View file

@ -58,7 +58,7 @@ AppConnectHandle GSWApp_Open(GSWAppRequest* p_pAppRequest,void* p_pLogServerData
if (!p_pAppRequest) if (!p_pAppRequest)
{ {
GSWLog(GSW_CRITICAL,p_pLogServerData, GSWLog(__FILE__, __LINE__, GSW_CRITICAL,p_pLogServerData,
"No AppRequest !"); "No AppRequest !");
//TODO //TODO
} }
@ -76,7 +76,7 @@ AppConnectHandle GSWApp_Open(GSWAppRequest* p_pAppRequest,void* p_pLogServerData
pHost=GSWUtil_FindHost(p_pAppRequest->pszHost,p_pLogServerData); pHost=GSWUtil_FindHost(p_pAppRequest->pszHost,p_pLogServerData);
if (!pHost) if (!pHost)
{ {
GSWLog(GSW_ERROR,p_pLogServerData, GSWLog(__FILE__, __LINE__, GSW_ERROR,p_pLogServerData,
"gethostbyname(%s) returns no host", "gethostbyname(%s) returns no host",
p_pAppRequest->pszHost); p_pAppRequest->pszHost);
} }
@ -95,7 +95,7 @@ AppConnectHandle GSWApp_Open(GSWAppRequest* p_pAppRequest,void* p_pLogServerData
iSocketDescr=socket(pHost->h_addrtype,SOCK_STREAM, 0); iSocketDescr=socket(pHost->h_addrtype,SOCK_STREAM, 0);
if (iSocketDescr<0) if (iSocketDescr<0)
{ {
GSWLog(GSW_ERROR, GSWLog(__FILE__, __LINE__, GSW_ERROR,
p_pLogServerData, p_pLogServerData,
"Can't Create socket to %s:%d. Error=%d (%s)", "Can't Create socket to %s:%d. Error=%d (%s)",
p_pAppRequest->pszHost, p_pAppRequest->pszHost,
@ -107,7 +107,7 @@ AppConnectHandle GSWApp_Open(GSWAppRequest* p_pAppRequest,void* p_pLogServerData
{ {
if (connect(iSocketDescr,(struct sockaddr*)&sin,sizeof(sin))<0) if (connect(iSocketDescr,(struct sockaddr*)&sin,sizeof(sin))<0)
{ {
GSWLog(GSW_ERROR, GSWLog(__FILE__, __LINE__, GSW_ERROR,
p_pLogServerData, p_pLogServerData,
"Can't connect to %s:%d. Error=%d (%s)", "Can't connect to %s:%d. Error=%d (%s)",
p_pAppRequest->pszHost, p_pAppRequest->pszHost,
@ -122,7 +122,7 @@ AppConnectHandle GSWApp_Open(GSWAppRequest* p_pAppRequest,void* p_pLogServerData
FILE* pFileRead=fdopen(iSocketDescr,"r"); FILE* pFileRead=fdopen(iSocketDescr,"r");
if (!pFileRead) if (!pFileRead)
{ {
GSWLog(GSW_ERROR, GSWLog(__FILE__, __LINE__, GSW_ERROR,
p_pLogServerData, p_pLogServerData,
"Can't open for reading. Error=%d (%s)", "Can't open for reading. Error=%d (%s)",
errno, errno,
@ -135,7 +135,7 @@ AppConnectHandle GSWApp_Open(GSWAppRequest* p_pAppRequest,void* p_pLogServerData
FILE* pFileWrite=fdopen(iSocketDescr,"w"); FILE* pFileWrite=fdopen(iSocketDescr,"w");
if (!pFileWrite) if (!pFileWrite)
{ {
GSWLog(GSW_ERROR, GSWLog(__FILE__, __LINE__, GSW_ERROR,
p_pLogServerData, p_pLogServerData,
"Can't open for writing. Error=%d (%s)", "Can't open for writing. Error=%d (%s)",
errno, errno,
@ -170,14 +170,14 @@ void GSWApp_Close(AppConnectHandle p_handle,void* p_pLogServerData)
if (!p_handle) if (!p_handle)
{ {
GSWLog(GSW_CRITICAL,p_pLogServerData,"GSWApp_Close: no Handle !"); GSWLog(__FILE__, __LINE__, GSW_CRITICAL,p_pLogServerData,"GSWApp_Close: no Handle !");
} }
else else
{ {
AppConnectSocketHandle handle=(AppConnectSocketHandle)p_handle; AppConnectSocketHandle handle=(AppConnectSocketHandle)p_handle;
if (!handle->iSocketDescr) if (!handle->iSocketDescr)
{ {
GSWLog(GSW_CRITICAL,p_pLogServerData,"GSWApp_Close: no socket desc !"); GSWLog(__FILE__, __LINE__, GSW_CRITICAL,p_pLogServerData,"GSWApp_Close: no socket desc !");
} }
else else
{ {
@ -200,14 +200,14 @@ int GSWApp_SendLine(AppConnectHandle p_handle, CONST char* p_pszBuffer,void* p_p
if (!p_handle) if (!p_handle)
{ {
GSWLog(GSW_CRITICAL,p_pLogServerData,"GSWApp_SendLine: no Handle !"); GSWLog(__FILE__, __LINE__, GSW_CRITICAL,p_pLogServerData,"GSWApp_SendLine: no Handle !");
} }
else else
{ {
AppConnectSocketHandle handle=(AppConnectSocketHandle)p_handle; AppConnectSocketHandle handle=(AppConnectSocketHandle)p_handle;
if (!handle->pFileWrite) if (!handle->pFileWrite)
{ {
GSWLog(GSW_CRITICAL,p_pLogServerData,"GSWApp_SendLine: no write file handle !"); GSWLog(__FILE__, __LINE__, GSW_CRITICAL,p_pLogServerData,"GSWApp_SendLine: no write file handle !");
} }
else else
{ {
@ -218,7 +218,7 @@ int GSWApp_SendLine(AppConnectHandle p_handle, CONST char* p_pszBuffer,void* p_p
} }
else else
{ {
GSWLog(GSW_ERROR, GSWLog(__FILE__, __LINE__, GSW_ERROR,
p_pLogServerData, p_pLogServerData,
"GSWApp_SendLine failed. Error=%d (%s)", "GSWApp_SendLine failed. Error=%d (%s)",
errno, errno,
@ -246,14 +246,14 @@ int GSWApp_SendBlock(AppConnectHandle p_handle,
if (!p_handle) if (!p_handle)
{ {
GSWLog(GSW_CRITICAL,p_pLogServerData,"GSWApp_SendBlock: no Handle !"); GSWLog(__FILE__, __LINE__, GSW_CRITICAL,p_pLogServerData,"GSWApp_SendBlock: no Handle !");
} }
else else
{ {
AppConnectSocketHandle handle=(AppConnectSocketHandle)p_handle; AppConnectSocketHandle handle=(AppConnectSocketHandle)p_handle;
if (!handle->pFileWrite) if (!handle->pFileWrite)
{ {
GSWLog(GSW_CRITICAL,p_pLogServerData,"GSWApp_SendBlock: no write file handle !"); GSWLog(__FILE__, __LINE__, GSW_CRITICAL,p_pLogServerData,"GSWApp_SendBlock: no write file handle !");
} }
else else
{ {
@ -261,7 +261,7 @@ int GSWApp_SendBlock(AppConnectHandle p_handle,
fflush(handle->pFileWrite); fflush(handle->pFileWrite);
if (iBytesSent<0) if (iBytesSent<0)
{ {
GSWLog(GSW_ERROR, GSWLog(__FILE__, __LINE__, GSW_ERROR,
p_pLogServerData, p_pLogServerData,
"send failed. Error=%d (%s)", "send failed. Error=%d (%s)",
errno, errno,
@ -290,14 +290,14 @@ int GSWApp_ReceiveLine(AppConnectHandle p_handle,
*p_pszBuffer=0; *p_pszBuffer=0;
if (!p_handle) if (!p_handle)
{ {
GSWLog(GSW_CRITICAL,p_pLogServerData,"GSWApp_ReceiveLine: no Handle !"); GSWLog(__FILE__, __LINE__, GSW_CRITICAL,p_pLogServerData,"GSWApp_ReceiveLine: no Handle !");
} }
else else
{ {
AppConnectSocketHandle handle=(AppConnectSocketHandle)p_handle; AppConnectSocketHandle handle=(AppConnectSocketHandle)p_handle;
if (!handle->pFileRead) if (!handle->pFileRead)
{ {
GSWLog(GSW_CRITICAL,p_pLogServerData,"GSWApp_ReceiveLine: no read file handle !"); GSWLog(__FILE__, __LINE__, GSW_CRITICAL,p_pLogServerData,"GSWApp_ReceiveLine: no read file handle !");
} }
else else
{ {
@ -331,14 +331,14 @@ int GSWApp_ReceiveBlock(AppConnectHandle p_handle,
if (!p_handle) if (!p_handle)
{ {
GSWLog(GSW_CRITICAL,p_pLogServerData,"GSWApp_ReceiveBlock: no Handle !"); GSWLog(__FILE__, __LINE__, GSW_CRITICAL,p_pLogServerData,"GSWApp_ReceiveBlock: no Handle !");
} }
else else
{ {
AppConnectSocketHandle handle=(AppConnectSocketHandle)p_handle; AppConnectSocketHandle handle=(AppConnectSocketHandle)p_handle;
if (!handle->pFileRead) if (!handle->pFileRead)
{ {
GSWLog(GSW_CRITICAL,p_pLogServerData,"GSWApp_ReceiveBlock: no read file handle !"); GSWLog(__FILE__, __LINE__, GSW_CRITICAL,p_pLogServerData,"GSWApp_ReceiveBlock: no read file handle !");
} }
else else
{ {

View file

@ -92,7 +92,7 @@ GSWAppRequest_SendAppRequestToApp(GSWHTTPRequest **p_ppHTTPRequest,
if (!fAppFound) if (!fAppFound)
{ {
GSWLog(GSW_WARNING,p_pLogServerData, GSWLog(__FILE__, __LINE__, GSW_WARNING,p_pLogServerData,
"App '%s' not found", "App '%s' not found",
p_pAppRequest->pszName); p_pAppRequest->pszName);
//TODO //TODO
@ -118,7 +118,7 @@ GSWAppRequest_SendAppRequestToApp(GSWHTTPRequest **p_ppHTTPRequest,
while (!pHTTPResponse && fAppFound && iAttemptsRemaining-->0) while (!pHTTPResponse && fAppFound && iAttemptsRemaining-->0)
{ {
fAppNotResponding=FALSE; fAppNotResponding=FALSE;
GSWLog(GSW_INFO,p_pLogServerData,"Attempt# %d: Trying to contact %s:%d on %s:%d", GSWLog(__FILE__, __LINE__, GSW_INFO,p_pLogServerData,"Attempt# %d: Trying to contact %s:%d on %s:%d",
(int)(APP_CONNECT_RETRIES_NB-iAttemptsRemaining), (int)(APP_CONNECT_RETRIES_NB-iAttemptsRemaining),
p_pAppRequest->pszName, p_pAppRequest->pszName,
p_pAppRequest->iInstance, p_pAppRequest->iInstance,
@ -159,7 +159,7 @@ GSWAppRequest_SendAppRequestToApp(GSWHTTPRequest **p_ppHTTPRequest,
hConnect, hConnect,
p_pLogServerData) != 0) p_pLogServerData) != 0)
{ {
GSWLog(GSW_ERROR,p_pLogServerData,"Failed to send request to application %s:%d on %s:%d", GSWLog(__FILE__, __LINE__,GSW_ERROR,p_pLogServerData,"Failed to send request to application %s:%d on %s:%d",
p_pAppRequest->pszName, p_pAppRequest->pszName,
p_pAppRequest->iInstance, p_pAppRequest->iInstance,
p_pAppRequest->pszHost, p_pAppRequest->pszHost,
@ -205,7 +205,7 @@ GSWAppRequest_SendAppRequestToApp(GSWHTTPRequest **p_ppHTTPRequest,
if (value && (strncmp(value,"YES",3)==0)) if (value && (strncmp(value,"YES",3)==0))
{ {
// refuseNewSessions == YES in app // refuseNewSessions == YES in app
GSWLog(GSW_INFO,p_pLogServerData, GSWLog(__FILE__, __LINE__, GSW_INFO,p_pLogServerData,
"### This app (%s / %d) is refusing all new sessions ###", "### This app (%s / %d) is refusing all new sessions ###",
appName, appInstance); appName, appInstance);
GSWAppInfo_Set(appName, appInstance, TRUE); GSWAppInfo_Set(appName, appInstance, TRUE);
@ -226,7 +226,7 @@ GSWAppRequest_SendAppRequestToApp(GSWHTTPRequest **p_ppHTTPRequest,
else else
{ {
fAppNotResponding=TRUE; fAppNotResponding=TRUE;
GSWLog(GSW_WARNING,p_pLogServerData, GSWLog(__FILE__, __LINE__, GSW_WARNING,p_pLogServerData,
"%s:%d NOT LISTENING on %s:%d", "%s:%d NOT LISTENING on %s:%d",
p_pAppRequest->pszName, p_pAppRequest->pszName,
p_pAppRequest->iInstance, p_pAppRequest->iInstance,
@ -267,7 +267,7 @@ GSWAppRequest_SendAppRequestToApp(GSWHTTPRequest **p_ppHTTPRequest,
if (!pHTTPResponse) if (!pHTTPResponse)
{ {
GSWLog(GSW_WARNING,p_pLogServerData, GSWLog(__FILE__, __LINE__, GSW_WARNING,p_pLogServerData,
"Application %s not found or not responding", "Application %s not found or not responding",
p_pAppRequest->pszName); p_pAppRequest->pszName);
pHTTPResponse = GSWDumpConfigFile(p_pAppRequest->pStats, pHTTPResponse = GSWDumpConfigFile(p_pAppRequest->pStats,
@ -318,7 +318,7 @@ GSWAppRequest_HandleRequest(GSWHTTPRequest **p_ppHTTPRequest,
if (!p_pURLComponents) if (!p_pURLComponents)
{ {
GSWLog(GSW_CRITICAL,p_pLogServerData, GSWLog(__FILE__, __LINE__, GSW_CRITICAL,p_pLogServerData,
"p_pURLComponents is NULL in GSWAppRequest_HandleRequest"); "p_pURLComponents is NULL in GSWAppRequest_HandleRequest");
} }
else else
@ -400,7 +400,7 @@ GSWAppRequest_HandleRequest(GSWHTTPRequest **p_ppHTTPRequest,
{ {
stAppRequest.iInstance = atoi(pszInstanceCookie + stAppRequest.iInstance = atoi(pszInstanceCookie +
strlen(g_szGSWeb_InstanceCookie[GSWNAMES_INDEX])); strlen(g_szGSWeb_InstanceCookie[GSWNAMES_INDEX]));
GSWLog(GSW_INFO,p_pLogServerData, GSWLog(__FILE__, __LINE__, GSW_INFO,p_pLogServerData,
"Cookie instance %d from %s", "Cookie instance %d from %s",
stAppRequest.iInstance, stAppRequest.iInstance,
pszCookie); pszCookie);
@ -413,7 +413,7 @@ GSWAppRequest_HandleRequest(GSWHTTPRequest **p_ppHTTPRequest,
{ {
stAppRequest.iInstance = atoi(pszInstanceCookie + stAppRequest.iInstance = atoi(pszInstanceCookie +
strlen(g_szGSWeb_InstanceCookie[WONAMES_INDEX])); strlen(g_szGSWeb_InstanceCookie[WONAMES_INDEX]));
GSWLog(GSW_INFO,p_pLogServerData, GSWLog(__FILE__, __LINE__, GSW_INFO,p_pLogServerData,
"Cookie instance %d from %s", "Cookie instance %d from %s",
stAppRequest.iInstance, stAppRequest.iInstance,
pszCookie); pszCookie);

View file

@ -123,7 +123,7 @@ GSWConfig_Init(GSWDict *p_pDict,
pszPath=GSWDict_ValueForKey(p_pDict,g_szGSWeb_Conf_ConfigFilePath); pszPath=GSWDict_ValueForKey(p_pDict,g_szGSWeb_Conf_ConfigFilePath);
GSWConfig_SetConfigFilePath(pszPath); GSWConfig_SetConfigFilePath(pszPath);
}; };
GSWLog(GSW_INFO,p_pLogServerData, GSWLog(__FILE__, __LINE__,GSW_INFO,p_pLogServerData,
"GSWConfig_Init: %s %s path: %s", "GSWConfig_Init: %s %s path: %s",
g_szServerStringInfo,g_szAdaptorStringInfo,pszPath); g_szServerStringInfo,g_szAdaptorStringInfo,pszPath);
GSWLock_Init(g_lockAppList); GSWLock_Init(g_lockAppList);
@ -180,7 +180,7 @@ GSWConfig_SetConfigFilePath(CONST char *p_pszConfigFilePath)
} }
else else
{ {
GSWLog(GSW_CRITICAL,NULL, GSWLog(__FILE__, __LINE__, GSW_CRITICAL,NULL,
"No path for config file. Add a %s directive in your web server configuration", "No path for config file. Add a %s directive in your web server configuration",
g_szGSWeb_Conf_ConfigFilePath); g_szGSWeb_Conf_ConfigFilePath);
}; };
@ -255,7 +255,7 @@ GSWConfig_ReadIFND(CONST char *p_pszConfigPath,
if (!p_pszConfigPath) if (!p_pszConfigPath)
{ {
GSWLog(GSW_CRITICAL,p_pLogServerData,"No path for config file."); GSWLog(__FILE__, __LINE__, GSW_CRITICAL,p_pLogServerData,"No path for config file.");
eResult=EGSWConfigResult__Error; eResult=EGSWConfigResult__Error;
} }
else else
@ -266,7 +266,7 @@ GSWConfig_ReadIFND(CONST char *p_pszConfigPath,
if (timeNow-timePrevious<CONFIG_FILE_STAT_INTERVAL) if (timeNow-timePrevious<CONFIG_FILE_STAT_INTERVAL)
{ {
GSWLog(GSW_INFO,p_pLogServerData, GSWLog(__FILE__, __LINE__,GSW_INFO,p_pLogServerData,
"GSWConfig_ReadIFND: Not Reading : Less than %d sec since last read config file.", "GSWConfig_ReadIFND: Not Reading : Less than %d sec since last read config file.",
(int)CONFIG_FILE_STAT_INTERVAL); (int)CONFIG_FILE_STAT_INTERVAL);
eResult=EGSWConfigResult__NotChanged; eResult=EGSWConfigResult__NotChanged;
@ -280,41 +280,41 @@ GSWConfig_ReadIFND(CONST char *p_pszConfigPath,
*p_pLastReadTime = timeNow; *p_pLastReadTime = timeNow;
if (stStat.st_mtime>timePrevious) if (stStat.st_mtime>timePrevious)
{ {
GSWLog(GSW_INFO,p_pLogServerData, GSWLog(__FILE__, __LINE__,GSW_INFO,p_pLogServerData,
"GSWConfig_ReadIFND: Reading new configuration from %s", "GSWConfig_ReadIFND: Reading new configuration from %s",
p_pszConfigPath); p_pszConfigPath);
*p_ppPropList=PLGetProplistWithPath(p_pszConfigPath); *p_ppPropList=PLGetProplistWithPath(p_pszConfigPath);
if (*p_ppPropList) if (*p_ppPropList)
{ {
GSWLog(GSW_WARNING,p_pLogServerData, GSWLog(__FILE__, __LINE__, GSW_WARNING,p_pLogServerData,
"GSWConfig_ReadIFND: New configuration from %s readen", "GSWConfig_ReadIFND: New configuration from %s readen",
p_pszConfigPath); p_pszConfigPath);
} }
else else
{ {
GSWLog(GSW_CRITICAL,p_pLogServerData, GSWLog(__FILE__, __LINE__, GSW_CRITICAL,p_pLogServerData,
"Can't read configuration file %s (PLGetProplistWithPath).", "Can't read configuration file %s (PLGetProplistWithPath).",
p_pszConfigPath); p_pszConfigPath);
}; };
} }
else else
{ {
GSWLog(GSW_INFO,p_pLogServerData, GSWLog(__FILE__, __LINE__,GSW_INFO,p_pLogServerData,
"GSWConfig_ReadIFND: Not Reading : config file not modified since last read."); "GSWConfig_ReadIFND: Not Reading : config file not modified since last read.");
eResult=EGSWConfigResult__NotChanged; eResult=EGSWConfigResult__NotChanged;
} }
} }
else else
{ {
GSWLog(GSW_CRITICAL,p_pLogServerData, GSWLog(__FILE__, __LINE__, GSW_CRITICAL,p_pLogServerData,
"GSWConfig_ReadIFND: config file %s does not exist.", "GSWConfig_ReadIFND: config file %s does not exist.",
p_pszConfigPath); p_pszConfigPath);
eResult=EGSWConfigResult__Error; eResult=EGSWConfigResult__Error;
}; };
}; };
}; };
GSWLog(GSW_INFO,p_pLogServerData,"GSWConfig_ReadIFND: result= %d", GSWLog(__FILE__, __LINE__,GSW_INFO,p_pLogServerData,"GSWConfig_ReadIFND: result= %d",
(int)eResult); (int)eResult);
return eResult; return eResult;
}; };
@ -452,7 +452,7 @@ GSWConfig_PropListInstanceToInstance(GSWAppInstance *p_pInstance,
}; };
}; };
GSWLog(GSW_INFO,p_pLogServerData, GSWLog(__FILE__, __LINE__,GSW_INFO,p_pLogServerData,
"Config: App=%p %s instance %d host %s port %d Valid:%s timeNextRetryTime %d", "Config: App=%p %s instance %d host %s port %d Valid:%s timeNextRetryTime %d",
p_pApp, p_pApp,
p_pApp->pszName, p_pApp->pszName,
@ -519,7 +519,7 @@ GSWConfig_PropListApplicationToApplication(GSWApp *p_pApp,
{ {
if (strlen(pszUnavailableUntil)<8) if (strlen(pszUnavailableUntil)<8)
{ {
GSWLog(GSW_WARNING,NULL, GSWLog(__FILE__, __LINE__, GSW_WARNING,NULL,
"Bad format for unavailableUntil ('%s'). Should be YYYYMMDD or YYYYMMDD-HHMMSS", "Bad format for unavailableUntil ('%s'). Should be YYYYMMDD or YYYYMMDD-HHMMSS",
pszUnavailableUntil); pszUnavailableUntil);
} }
@ -535,7 +535,7 @@ GSWConfig_PropListApplicationToApplication(GSWApp *p_pApp,
+(pszUnavailableUntil[3]-'0'))-1900; +(pszUnavailableUntil[3]-'0'))-1900;
if (tmStruct.tm_year<0) if (tmStruct.tm_year<0)
{ {
GSWLog(GSW_WARNING,p_pLogServerData, GSWLog(__FILE__, __LINE__, GSW_WARNING,p_pLogServerData,
"Bad year (%d) in unavailableUntil ('%s')", "Bad year (%d) in unavailableUntil ('%s')",
(int)(tmStruct.tm_year+1900), (int)(tmStruct.tm_year+1900),
pszUnavailableUntil); pszUnavailableUntil);
@ -547,7 +547,7 @@ GSWConfig_PropListApplicationToApplication(GSWApp *p_pApp,
+(pszUnavailableUntil[5]-'0'))-1; +(pszUnavailableUntil[5]-'0'))-1;
if (tmStruct.tm_mon<0 || tmStruct.tm_mon>11) if (tmStruct.tm_mon<0 || tmStruct.tm_mon>11)
{ {
GSWLog(GSW_WARNING,p_pLogServerData, GSWLog(__FILE__, __LINE__, GSW_WARNING,p_pLogServerData,
"Bad month (%d) in unavailableUntil ('%s')", "Bad month (%d) in unavailableUntil ('%s')",
(int)(tmStruct.tm_mon+1), (int)(tmStruct.tm_mon+1),
pszUnavailableUntil); pszUnavailableUntil);
@ -558,7 +558,7 @@ GSWConfig_PropListApplicationToApplication(GSWApp *p_pApp,
+(pszUnavailableUntil[7]-'0')); +(pszUnavailableUntil[7]-'0'));
if (tmStruct.tm_mday<1 || tmStruct.tm_mday>31) if (tmStruct.tm_mday<1 || tmStruct.tm_mday>31)
{ {
GSWLog(GSW_WARNING,p_pLogServerData, GSWLog(__FILE__, __LINE__, GSW_WARNING,p_pLogServerData,
"Bad month day (%d) in unavailableUntil ('%s')", "Bad month day (%d) in unavailableUntil ('%s')",
(int)(tmStruct.tm_mday), (int)(tmStruct.tm_mday),
pszUnavailableUntil); pszUnavailableUntil);

View file

@ -34,7 +34,7 @@ GSWDict_SetCapacity(GSWDict *p_pDict,unsigned int p_uCapacity)
{ {
if (!p_pDict) if (!p_pDict)
{ {
GSWLog(GSW_CRITICAL,NULL,"NULL GSWDict"); GSWLog(__FILE__, __LINE__, GSW_CRITICAL,NULL,"NULL GSWDict");
} }
else else
{ {
@ -65,7 +65,7 @@ GSWDict_FreeElem(GSWDictElem *p_pElem,void *p_pData)
{ {
if (!p_pElem) if (!p_pElem)
{ {
GSWLog(GSW_CRITICAL,NULL,"NULL GSWDict pElem"); GSWLog(__FILE__, __LINE__, GSW_CRITICAL,NULL,"NULL GSWDict pElem");
} }
else else
{ {
@ -93,7 +93,7 @@ GSWDict_Free(GSWDict *p_pDict)
{ {
if (!p_pDict) if (!p_pDict)
{ {
GSWLog(GSW_ERROR,NULL,"NULL GSWDict"); GSWLog(__FILE__, __LINE__, GSW_ERROR,NULL,"NULL GSWDict");
} }
else else
{ {
@ -122,7 +122,7 @@ GSWDict_Count(GSWDict *p_pDict)
unsigned int uCount=0; unsigned int uCount=0;
if (!p_pDict) if (!p_pDict)
{ {
GSWLog(GSW_CRITICAL,NULL,"NULL GSWDict"); GSWLog(__FILE__, __LINE__, GSW_CRITICAL,NULL,"NULL GSWDict");
} }
else else
{ {
@ -144,7 +144,7 @@ GSWDict_Add(GSWDict *p_pDict,
GSWDictElem *pElem=NULL; GSWDictElem *pElem=NULL;
if (!p_pDict) if (!p_pDict)
{ {
GSWLog(GSW_CRITICAL,NULL,"NULL GSWDict"); GSWLog(__FILE__, __LINE__, GSW_CRITICAL,NULL,"NULL GSWDict");
} }
else else
{ {
@ -165,7 +165,7 @@ GSWDict_Add(GSWDict *p_pDict,
}; };
if (!pElem) if (!pElem)
{ {
GSWLog(GSW_CRITICAL,NULL,"No pElem in GSWDict Add"); GSWLog(__FILE__, __LINE__, GSW_CRITICAL,NULL,"No pElem in GSWDict Add");
}; };
pElem->pszKey=strdup(p_pszKey); pElem->pszKey=strdup(p_pszKey);
pElem->pValue=p_pValue; pElem->pValue=p_pValue;
@ -198,7 +198,7 @@ GSWDict_FindKey(GSWDict *p_pDict,
GSWDictElem *pElem=NULL; GSWDictElem *pElem=NULL;
if (!p_pDict) if (!p_pDict)
{ {
GSWLog(GSW_CRITICAL,NULL,"NULL GSWDict"); GSWLog(__FILE__, __LINE__, GSW_CRITICAL,NULL,"NULL GSWDict");
} }
else else
{ {
@ -233,7 +233,7 @@ GSWDict_PerformForAllElem(GSWDict *p_pDict,
{ {
if (!p_pDict) if (!p_pDict)
{ {
GSWLog(GSW_CRITICAL,NULL,"NULL GSWDict"); GSWLog(__FILE__, __LINE__, GSW_CRITICAL,NULL,"NULL GSWDict");
} }
else else
{ {
@ -253,7 +253,7 @@ GSWDict_AllKeys(GSWDict *p_pDict)
GSWList *pList=NULL; GSWList *pList=NULL;
if (!p_pDict) if (!p_pDict)
{ {
GSWLog(GSW_CRITICAL,NULL,"NULL GSWDict"); GSWLog(__FILE__, __LINE__, GSW_CRITICAL,NULL,"NULL GSWDict");
} }
else else
{ {
@ -273,11 +273,11 @@ void GSWDict_AddStringDupFromDict(GSWDict *p_pDictDst,GSWDict *p_pDictSrc)
{ {
if (!p_pDictSrc) if (!p_pDictSrc)
{ {
GSWLog(GSW_CRITICAL,NULL,"NULL GSWDict src"); GSWLog(__FILE__, __LINE__, GSW_CRITICAL,NULL,"NULL GSWDict src");
} }
else if (!p_pDictDst) else if (!p_pDictDst)
{ {
GSWLog(GSW_CRITICAL,NULL,"NULL GSWDict dst"); GSWLog(__FILE__, __LINE__, GSW_CRITICAL,NULL,"NULL GSWDict dst");
} }
else else
{ {

View file

@ -99,7 +99,7 @@ GSWHTTPRequest_ValidateMethod(GSWHTTPRequest *p_pHTTPRequest,
GSWDebugLog(p_pLogServerData,"Start GSWHTTPRequest_ValidateMethod"); GSWDebugLog(p_pLogServerData,"Start GSWHTTPRequest_ValidateMethod");
if (!p_pHTTPRequest) if (!p_pHTTPRequest)
{ {
GSWLog(GSW_CRITICAL,p_pLogServerData, GSWLog(__FILE__, __LINE__, GSW_CRITICAL,p_pLogServerData,
"No Request in GSWHTTPRequest_ValidateMethod"); "No Request in GSWHTTPRequest_ValidateMethod");
pszMsg="No Request in GSWHTTPRequest_ValidateMethod"; pszMsg="No Request in GSWHTTPRequest_ValidateMethod";
} }
@ -201,7 +201,7 @@ GSWHTTPRequest_HTTPToAppRequest(GSWHTTPRequest *p_pHTTPRequest,
GSWDict_Log(p_pHTTPRequest->pHeaders,p_pLogServerData); GSWDict_Log(p_pHTTPRequest->pHeaders,p_pLogServerData);
GSWLog(GSW_INFO,p_pLogServerData,"App Request: %s", GSWLog(__FILE__, __LINE__, GSW_INFO,p_pLogServerData,"App Request: %s",
p_pHTTPRequest->pszRequest); p_pHTTPRequest->pszRequest);
GSWDebugLog(p_pLogServerData,"Stop GSWHTTPRequest_HTTPToAppRequest"); GSWDebugLog(p_pLogServerData,"Stop GSWHTTPRequest_HTTPToAppRequest");

View file

@ -93,7 +93,7 @@ GSWHTTPResponse_New(GSWTimeStats *p_pStats,
}; };
}; };
if (!fOk) if (!fOk)
GSWLog(GSW_ERROR,p_pLogServerData,"Invalid response"); GSWLog(__FILE__, __LINE__, GSW_ERROR,p_pLogServerData,"Invalid response");
return pHTTPResponse; return pHTTPResponse;
}; };
@ -429,7 +429,7 @@ GSWHTTPResponse_GetResponse(GSWTimeStats *p_pStats,
GSWDebugLog(p_pLogServerData,"iReceivedCount=%d",iReceivedCount); GSWDebugLog(p_pLogServerData,"iReceivedCount=%d",iReceivedCount);
if (iReceivedCount!= pHTTPResponse->uContentLength) if (iReceivedCount!= pHTTPResponse->uContentLength)
{ {
GSWLog(GSW_ERROR,p_pLogServerData, GSWLog(__FILE__, __LINE__, GSW_ERROR,p_pLogServerData,
"Content received (%i) doesn't equal to ContentLength (%u). Too bad, same player shoot again !", "Content received (%i) doesn't equal to ContentLength (%u). Too bad, same player shoot again !",
iReceivedCount, iReceivedCount,
pHTTPResponse->uContentLength); pHTTPResponse->uContentLength);
@ -464,7 +464,7 @@ GSWHTTPResponse_GetResponse(GSWTimeStats *p_pStats,
if (pHTTPResponse->pContent) if (pHTTPResponse->pContent)
{ {
char szTraceBuffer[pHTTPResponse->uContentLength+1]; char szTraceBuffer[pHTTPResponse->uContentLength+1];
GSWLog(GSW_INFO,p_pLogServerData,"\ncontent (%d Bytes)=\n", GSWLog(__FILE__, __LINE__, GSW_INFO,p_pLogServerData,"\ncontent (%d Bytes)=\n",
pHTTPResponse->uContentLength); pHTTPResponse->uContentLength);
memcpy(szTraceBuffer,pHTTPResponse->pContent, memcpy(szTraceBuffer,pHTTPResponse->pContent,
pHTTPResponse->uContentLength); pHTTPResponse->uContentLength);
@ -474,7 +474,7 @@ GSWHTTPResponse_GetResponse(GSWTimeStats *p_pStats,
"%.*s", "%.*s",
(int)pHTTPResponse->uContentLength, (int)pHTTPResponse->uContentLength,
szTraceBuffer); szTraceBuffer);
// GSWLog(GSW_INFO,p_pLogServerData,"\nEND\n"); // GSWLog(__FILE__, __LINE__, GSW_INFO,p_pLogServerData,"\nEND\n");
}; };
#endif #endif
*/ */
@ -572,7 +572,7 @@ GSWHTTPResponse_BuildStatusResponse(GSWHTTPRequest *p_pHTTPRequest,
GSWDebugLog(p_pLogServerData, GSWDebugLog(p_pLogServerData,
"Start GSWHTTPResponse_BuildStatusResponse"); "Start GSWHTTPResponse_BuildStatusResponse");
GSWLog(GSW_INFO,p_pLogServerData,"Build Status Page."); GSWLog(__FILE__, __LINE__, GSW_INFO,p_pLogServerData,"Build Status Page.");
GSWConfig_LoadConfiguration(p_pLogServerData); GSWConfig_LoadConfiguration(p_pLogServerData);
GSWDict_AddString(pHTTPResponse->pHeaders, GSWDict_AddString(pHTTPResponse->pHeaders,
g_szHeader_ContentType, g_szHeader_ContentType,
@ -630,7 +630,7 @@ GSWDumpConfigFile(GSWTimeStats *p_pStats,
char szReqAppName[MAXPATHLEN]="Unknown"; char szReqAppName[MAXPATHLEN]="Unknown";
GSWDebugLog(p_pLogServerData,"Start GSWDumpConfigFile"); GSWDebugLog(p_pLogServerData,"Start GSWDumpConfigFile");
GSWLog(GSW_INFO,p_pLogServerData,"Creating Applications Page."); GSWLog(__FILE__, __LINE__, GSW_INFO,p_pLogServerData,"Creating Applications Page.");
if (!g_pszLocalHostName) if (!g_pszLocalHostName)
{ {
char szHostName[MAXHOSTNAMELEN+1]; char szHostName[MAXHOSTNAMELEN+1];

View file

@ -84,7 +84,7 @@ GSWLoadBalancing_FindApp(GSWAppRequest *p_pAppRequest,
{ {
if (!pAppInstance->pApp) if (!pAppInstance->pApp)
{ {
GSWLog(GSW_CRITICAL,p_pLogServerData, GSWLog(__FILE__, __LINE__,GSW_CRITICAL,p_pLogServerData,
"AppInstance pApp is null pAppInstance=%p", "AppInstance pApp is null pAppInstance=%p",
pAppInstance); pAppInstance);
}; };
@ -94,7 +94,7 @@ GSWLoadBalancing_FindApp(GSWAppRequest *p_pAppRequest,
time(&curTime); time(&curTime);
if (pAppInstance->timeNextRetryTime<curTime) if (pAppInstance->timeNextRetryTime<curTime)
{ {
GSWLog(GSW_WARNING, GSWLog(__FILE__, __LINE__,GSW_WARNING,
p_pLogServerData, p_pLogServerData,
"LoadBalance: Instance %s:%d was marked dead for %d secs. Now resurecting !", "LoadBalance: Instance %s:%d was marked dead for %d secs. Now resurecting !",
p_pAppRequest->pszName, p_pAppRequest->pszName,
@ -265,7 +265,7 @@ GSWLoadBalancing_MarkNotRespondingApp(GSWAppRequest *p_pAppRequest,
pAppInstance->uOpenedRequestsNb--; pAppInstance->uOpenedRequestsNb--;
pAppInstance->uNotRespondingRequestsNb++; pAppInstance->uNotRespondingRequestsNb++;
pAppInstance->timeNextRetryTime=now+APP_CONNECT_RETRY_DELAY; pAppInstance->timeNextRetryTime=now+APP_CONNECT_RETRY_DELAY;
GSWLog(GSW_WARNING,p_pLogServerData, GSWLog(__FILE__, __LINE__,GSW_WARNING,p_pLogServerData,
"Marking %s unresponsive for %d s. notResonding count: %u handled count: %u", "Marking %s unresponsive for %d s. notResonding count: %u handled count: %u",
p_pAppRequest->pszName,(int)APP_CONNECT_RETRY_DELAY, p_pAppRequest->pszName,(int)APP_CONNECT_RETRY_DELAY,
pAppInstance->uNotRespondingRequestsNb, pAppInstance->uNotRespondingRequestsNb,
@ -287,7 +287,7 @@ GSWLoadBalancing_StartAppRequest(GSWAppRequest *p_pAppRequest,
if (pAppInstance->timeNextRetryTime!=0) if (pAppInstance->timeNextRetryTime!=0)
{ {
pAppInstance->timeNextRetryTime=0; pAppInstance->timeNextRetryTime=0;
GSWLog(GSW_WARNING,p_pLogServerData, GSWLog(__FILE__, __LINE__,GSW_WARNING,p_pLogServerData,
"Marking %s as alive",p_pAppRequest->pszName); "Marking %s as alive",p_pAppRequest->pszName);
}; };
} }

View file

@ -183,7 +183,7 @@ void GSWStats_logStats(GSWTimeStats *p_pStats,
void *p_pLogServerData) void *p_pLogServerData)
{ {
char* formattedStats=GSWStats_formatStats(p_pStats,NULL,p_pLogServerData); char* formattedStats=GSWStats_formatStats(p_pStats,NULL,p_pLogServerData);
GSWLog(GSW_INFO,p_pLogServerData,"%s",formattedStats); GSWLog(__FILE__, __LINE__,GSW_INFO,p_pLogServerData,"%s",formattedStats);
if (formattedStats) if (formattedStats)
free(formattedStats); free(formattedStats);
}; };

View file

@ -202,7 +202,7 @@ GSWParseURL(GSWURLComponents *p_pURLComponents,
if (!pURLCPrefix->pszStart || pURLCPrefix->iLength<=0) if (!pURLCPrefix->pszStart || pURLCPrefix->iLength<=0)
{ {
eError=GSWURLError_InvalidPrefix; eError=GSWURLError_InvalidPrefix;
GSWLog(GSW_ERROR,p_pLogServerData,"ParseURL GSWURLError_InvalidPrefix"); GSWLog(__FILE__, __LINE__, GSW_ERROR,p_pLogServerData,"ParseURL GSWURLError_InvalidPrefix");
} }
else else
{ {
@ -212,7 +212,7 @@ GSWParseURL(GSWURLComponents *p_pURLComponents,
if (!pURLCAppName->pszStart || pURLCAppName->iLength<=0) if (!pURLCAppName->pszStart || pURLCAppName->iLength<=0)
{ {
eError=GSWURLError_InvalidAppName; eError=GSWURLError_InvalidAppName;
GSWLog(GSW_ERROR,p_pLogServerData, GSWLog(__FILE__, __LINE__, GSW_ERROR,p_pLogServerData,
"ParseURL GSWURLError_InvalidAppName"); "ParseURL GSWURLError_InvalidAppName");
} }
else else
@ -223,7 +223,7 @@ GSWParseURL(GSWURLComponents *p_pURLComponents,
if (!pURLCAppNum->pszStart) if (!pURLCAppNum->pszStart)
{ {
eError=GSWURLError_InvalidAppNumber; eError=GSWURLError_InvalidAppNumber;
GSWLog(GSW_ERROR,p_pLogServerData, GSWLog(__FILE__, __LINE__, GSW_ERROR,p_pLogServerData,
"ParseURL GSWURLError_InvalidAppNumber"); "ParseURL GSWURLError_InvalidAppNumber");
} }
else else
@ -236,7 +236,7 @@ GSWParseURL(GSWURLComponents *p_pURLComponents,
&& pURLCReqHandlerPath->iLength>0) && pURLCReqHandlerPath->iLength>0)
{ {
eError=GSWURLError_InvalidRequestHandlerKey; eError=GSWURLError_InvalidRequestHandlerKey;
GSWLog(GSW_ERROR,p_pLogServerData, GSWLog(__FILE__, __LINE__, GSW_ERROR,p_pLogServerData,
"ParseURL GSWURLError_InvalidRequestHandlerKey"); "ParseURL GSWURLError_InvalidRequestHandlerKey");
} }
else else

View file

@ -162,11 +162,11 @@ VGSWLogSizedIntern(char *file,
#if defined(Apache) #if defined(Apache)
#if defined(Apache2) #if defined(Apache2)
ap_log_error(APLOG_MARK,p_iLevel,0, ap_log_error(file,line,p_iLevel,0,
(server_rec *)p_pLogServerData, (server_rec *)p_pLogServerData,
"GSWeb[%lu]: %s",(unsigned long)getpid(),szBuffer); "GSWeb[%lu]: %s",(unsigned long)getpid(),szBuffer);
#else #else
ap_log_error(APLOG_MARK,p_iLevel, ap_log_error(file,line,p_iLevel,
(server_rec *)p_pLogServerData, (server_rec *)p_pLogServerData,
"GSWeb[%lu]: %s",(unsigned long)getpid(),szBuffer); "GSWeb[%lu]: %s",(unsigned long)getpid(),szBuffer);
#endif #endif
@ -176,7 +176,10 @@ VGSWLogSizedIntern(char *file,
//-------------------------------------------------------------------- //--------------------------------------------------------------------
void void
GSWLog(int p_iLevel, GSWLog(
char *file,
int line,
int p_iLevel,
#if defined(Apache) #if defined(Apache)
server_rec *p_pLogServerData, server_rec *p_pLogServerData,
#else #else
@ -186,8 +189,9 @@ GSWLog(int p_iLevel,
{ {
va_list ap; va_list ap;
va_start(ap,p_pszFormat); va_start(ap,p_pszFormat);
VGSWLogSizedIntern(NULL, VGSWLogSizedIntern(
0, file,
line,
NULL, NULL,
p_iLevel, p_iLevel,
p_pLogServerData, p_pLogServerData,
@ -594,14 +598,14 @@ GSWUtil_HostLookup(CONST char *p_pszHost,
if (!pHost) if (!pHost)
{ {
GSWLog(GSW_ERROR,p_pLogServerData, GSWLog(__FILE__, __LINE__,GSW_ERROR,p_pLogServerData,
"gethostbyname(%s) returns no host: %s", "gethostbyname(%s) returns no host: %s",
p_pszHost, p_pszHost,
hstrerror(error)); hstrerror(error));
} }
else if (pHost->h_addrtype != AF_INET) else if (pHost->h_addrtype != AF_INET)
{ {
GSWLog(GSW_ERROR,p_pLogServerData,"Wrong address type in hostptr for host %s",p_pszHost); GSWLog(__FILE__, __LINE__,GSW_ERROR,p_pLogServerData,"Wrong address type in hostptr for host %s",p_pszHost);
}; };
if (pHost) if (pHost)
pHost=GSWUtil_CopyHostent(pHost); pHost=GSWUtil_CopyHostent(pHost);

View file

@ -86,7 +86,7 @@ long GSWTime_msecPart(GSWTime t);
{ if (!(condition)) \ { if (!(condition)) \
{ \ { \
char* format=0; \ char* format=0; \
GSWLog(GSW_CRITICAL,p_pLogServerData,"ARGHH"); \ GSWLog(__FILE__, __LINE__,GSW_CRITICAL,p_pLogServerData,"ARGHH"); \
format=malloc(strlen(p_pszFormat)+strlen(__FILE__)+101); \ format=malloc(strlen(p_pszFormat)+strlen(__FILE__)+101); \
sprintf(format,"In %s (%d): %s",__FILE__,__LINE__,p_pszFormat); \ sprintf(format,"In %s (%d): %s",__FILE__,__LINE__,p_pszFormat); \
free(format); \ free(format); \
@ -94,7 +94,9 @@ long GSWTime_msecPart(GSWTime t);
//==================================================================== //====================================================================
// Log Functions // Log Functions
void GSWLog(int p_iLevel, void GSWLog( char *file,
int line,
int p_iLevel,
#if defined(Apache) #if defined(Apache)
server_rec *p_pLogServerData, server_rec *p_pLogServerData,
#else #else
@ -103,9 +105,9 @@ void GSWLog(int p_iLevel,
CONST char *p_pszFormat, ...); CONST char *p_pszFormat, ...);
#define GSWDebugLog(p_pLogServerData,p_pszFormat, args...); \ #define GSWDebugLog(p_pLogServerData,p_pszFormat, args...); \
GSWLog(GSW_DEBUG,p_pLogServerData,p_pszFormat, ## args); GSWLog(__FILE__, __LINE__,GSW_DEBUG,p_pLogServerData,p_pszFormat, ## args);
#define GSWDebugLogCond(condition,p_pLogServerData,p_pszFormat, args...); \ #define GSWDebugLogCond(condition,p_pLogServerData,p_pszFormat, args...); \
{ if ((condition)) GSWLog(GSW_DEBUG,p_pLogServerData,p_pszFormat, ## args);}; { if ((condition)) GSWLog(__FILE__, __LINE__,GSW_DEBUG,p_pLogServerData,p_pszFormat, ## args);};
void GSWLogSized(int p_iLevel, void GSWLogSized(int p_iLevel,
#if defined(Apache) #if defined(Apache)