[mapguide-commits] r4820 - in sandbox/adsk/2.1: Common/MapGuideCommon/System Web/src Web/src/ApacheAgent Web/src/CgiAgent Web/src/HttpHandler Web/src/IsapiAgent Web/src/MapAgentCommon Web/src/WebSupport

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Apr 30 17:50:02 EDT 2010


Author: brucedechant
Date: 2010-04-30 17:50:01 -0400 (Fri, 30 Apr 2010)
New Revision: 4820

Modified:
   sandbox/adsk/2.1/Common/MapGuideCommon/System/ConfigProperties.cpp
   sandbox/adsk/2.1/Common/MapGuideCommon/System/ConfigProperties.h
   sandbox/adsk/2.1/Web/src/ApacheAgent/ApacheAgent.cpp
   sandbox/adsk/2.1/Web/src/CgiAgent/CgiAgent.cpp
   sandbox/adsk/2.1/Web/src/HttpHandler/HttpUtil.cpp
   sandbox/adsk/2.1/Web/src/HttpHandler/HttpUtil.h
   sandbox/adsk/2.1/Web/src/IsapiAgent/IsapiAgent.cpp
   sandbox/adsk/2.1/Web/src/MapAgentCommon/MapAgentCommon.cpp
   sandbox/adsk/2.1/Web/src/MapAgentCommon/MapAgentCommon.h
   sandbox/adsk/2.1/Web/src/WebSupport/InitializeWebTier.cpp
   sandbox/adsk/2.1/Web/src/webconfig.ini
Log:
Fix for trac ticket 1337 - Web tier logging
http://trac.osgeo.org/mapguide/ticket/1337

Notes:
- Add support for web tier logging (Error and Request logs)
- The following changes were made to the webconfig.ini file:
Added the following NEW properties to the GeneralProperties section:
  LogsPath

Added the following NEW properties to the AgentProperties section:
  ErrorLogEnabled
  ErrorLogFilename
  RequestLogEnabled
  RequestLogFilename


Modified: sandbox/adsk/2.1/Common/MapGuideCommon/System/ConfigProperties.cpp
===================================================================
--- sandbox/adsk/2.1/Common/MapGuideCommon/System/ConfigProperties.cpp	2010-04-30 20:59:58 UTC (rev 4819)
+++ sandbox/adsk/2.1/Common/MapGuideCommon/System/ConfigProperties.cpp	2010-04-30 21:50:01 UTC (rev 4820)
@@ -464,6 +464,14 @@
 const STRING MgConfigProperties::AgentDisableAuthoring                                      = L"DisableAuthoring";
 const STRING MgConfigProperties::AgentDisableWfs                                            = L"DisableWfs";
 const STRING MgConfigProperties::AgentDisableWms                                            = L"DisableWms";
+const STRING MgConfigProperties::AgentErrorLogEnabled                                       = L"ErrorLogEnabled";
+const bool   MgConfigProperties::DefaultAgentErrorLogEnabled                                = false;
+const STRING MgConfigProperties::AgentErrorLogFilename                                      = L"ErrorLogFilename";
+const STRING MgConfigProperties::DefaultAgentErrorLogFilename                               = L"Error.log";
+const STRING MgConfigProperties::AgentRequestLogEnabled                                     = L"RequestLogEnabled";
+const bool   MgConfigProperties::DefaultAgentRequestLogEnabled                              = false;
+const STRING MgConfigProperties::AgentRequestLogFilename                                    = L"RequestLogFilename";
+const STRING MgConfigProperties::DefaultAgentRequestLogFilename                             = L"Request.log";
 
 // ******************************************************************
 // OGC Properties
@@ -704,6 +712,10 @@
     { MgConfigProperties::AgentDisableAuthoring                                     , MgPropertyType::Boolean   , 0                                     , 1                                     , L""                                       },
     { MgConfigProperties::AgentDisableWfs                                           , MgPropertyType::Boolean   , 0                                     , 1                                     , L""                                       },
     { MgConfigProperties::AgentDisableWms                                           , MgPropertyType::Boolean   , 0                                     , 1                                     , L""                                       },
+    { MgConfigProperties::AgentErrorLogEnabled                                      , MgPropertyType::Boolean   , 0                                     , 1                                     , L""                                       },
+    { MgConfigProperties::AgentErrorLogFilename                                     , MgPropertyType::String    , MG_CONFIG_MIN_FILE_NAME_LENGTH        , MG_CONFIG_MAX_FILE_NAME_LENGTH        , MG_CONFIG_FILE_NAME_RESERVED_CHARACTERS   },
+    { MgConfigProperties::AgentRequestLogEnabled                                    , MgPropertyType::Boolean   , 0                                     , 1                                     , L""                                       },
+    { MgConfigProperties::AgentRequestLogFilename                                   , MgPropertyType::String    , MG_CONFIG_MIN_FILE_NAME_LENGTH        , MG_CONFIG_MAX_FILE_NAME_LENGTH        , MG_CONFIG_FILE_NAME_RESERVED_CHARACTERS   },
     { L""                                                                           , 0                         , 0.0                                   , 0.0                                   , L""                                       }
 };
 

Modified: sandbox/adsk/2.1/Common/MapGuideCommon/System/ConfigProperties.h
===================================================================
--- sandbox/adsk/2.1/Common/MapGuideCommon/System/ConfigProperties.h	2010-04-30 20:59:58 UTC (rev 4819)
+++ sandbox/adsk/2.1/Common/MapGuideCommon/System/ConfigProperties.h	2010-04-30 21:50:01 UTC (rev 4820)
@@ -812,6 +812,22 @@
     /// Disables Http operations used for OGC Wms
     static const STRING AgentDisableWms;                                /// value("DisableWms")
 
+    /// Agent error log enabled
+    static const STRING AgentErrorLogEnabled;                           /// value("ErrorLogEnabled")
+    static const bool DefaultAgentErrorLogEnabled;                      /// value(false)
+
+    /// Agent error log filename
+    static const STRING AgentErrorLogFilename;                          /// value("ErrorLogFilename")
+    static const STRING DefaultAgentErrorLogFilename;                   /// value("Error.log")
+
+    /// Agent request log enabled
+    static const STRING AgentRequestLogEnabled;                         /// value("RequestLogEnabled")
+    static const bool DefaultAgentRequestLogEnabled;                    /// value(false)
+
+    /// Agent error log filename
+    static const STRING AgentRequestLogFilename;                        /// value("RequestLogFilename")
+    static const STRING DefaultAgentRequestLogFilename;                 /// value("Request.log")
+
     /// OGC PROPERTIES SECTION -------------------------------------------------------------------------------------------
 
     /// Ogc properties

Modified: sandbox/adsk/2.1/Web/src/ApacheAgent/ApacheAgent.cpp
===================================================================
--- sandbox/adsk/2.1/Web/src/ApacheAgent/ApacheAgent.cpp	2010-04-30 20:59:58 UTC (rev 4819)
+++ sandbox/adsk/2.1/Web/src/ApacheAgent/ApacheAgent.cpp	2010-04-30 21:50:01 UTC (rev 4820)
@@ -155,24 +155,25 @@
 
     // check for CLIENTIP, if it's not there (and it shouldn't be),
     // add it in using httpClientIp. httpXFF or remoteAddr
+    STRING clientIp = L"";
     if (!params->ContainsParameter(L"CLIENTIP")) // NOXLATE
     {
         if (!httpClientIp.empty()
             && _stricmp(httpClientIp.c_str(), MapAgentStrings::Unknown) != 0)
         {
-            STRING wHttpClientIp = MgUtil::MultiByteToWideChar(httpClientIp);
-            params->AddParameter(L"CLIENTIP", wHttpClientIp); // NOXLATE
+            clientIp = MgUtil::MultiByteToWideChar(httpClientIp);
+            params->AddParameter(L"CLIENTIP", clientIp); // NOXLATE
         }
         else if (!httpXFF.empty()
             && _stricmp(httpXFF.c_str(), MapAgentStrings::Unknown) != 0)
         {
-            STRING wHttpXFF = MgUtil::MultiByteToWideChar(httpXFF);
-            params->AddParameter(L"CLIENTIP", wHttpXFF); // NOXLATE
+            clientIp = MgUtil::MultiByteToWideChar(httpXFF);
+            params->AddParameter(L"CLIENTIP", clientIp); // NOXLATE
         }
         else if (!remoteAddr.empty())
         {
-            STRING wRemoteAddr = MgUtil::MultiByteToWideChar(remoteAddr);
-            params->AddParameter(L"CLIENTIP", wRemoteAddr); // NOXLATE
+            clientIp = MgUtil::MultiByteToWideChar(remoteAddr);
+            params->AddParameter(L"CLIENTIP", clientIp); // NOXLATE
         }
     }
 
@@ -187,6 +188,17 @@
         gotAuth = MapAgentCommon::ParseAuth((char *)auth.c_str(), params);
     }
 
+    // Log request information
+    string postData = "";
+    if (!requestMethod.empty() && requestMethod.find("POST") != string::npos)  // NOXLATE
+    {
+        // Get the post xml data
+        postData = params->GetXmlPostData();
+    }
+
+    STRING client = params->GetParameterValue(MgHttpResourceStrings::reqClientAgent);
+    MapAgentCommon::LogRequest(client, clientIp, url, requestMethod, postData, query);
+
     Ptr<MgPropertyCollection> paramList = params->GetParameters()->GetPropertyCollection();
     if (paramList != NULL)
     {

Modified: sandbox/adsk/2.1/Web/src/CgiAgent/CgiAgent.cpp
===================================================================
--- sandbox/adsk/2.1/Web/src/CgiAgent/CgiAgent.cpp	2010-04-30 20:59:58 UTC (rev 4819)
+++ sandbox/adsk/2.1/Web/src/CgiAgent/CgiAgent.cpp	2010-04-30 21:50:01 UTC (rev 4820)
@@ -165,24 +165,25 @@
 
         // check for CLIENTIP, if it's not there (and it shouldn't be),
         // add it in using httpClientIp. httpXFF or remoteAddr
+        STRING clientIp = L"";
         if (!params->ContainsParameter(L"CLIENTIP")) // NOXLATE
         {
             if (NULL != httpClientIp && strlen(httpClientIp) > 0
                 && _stricmp(httpClientIp, MapAgentStrings::Unknown) != 0)
             {
-                STRING wHttpClientIp = MgUtil::MultiByteToWideChar(httpClientIp);
-                params->AddParameter(L"CLIENTIP", wHttpClientIp); // NOXLATE
+                clientIp = MgUtil::MultiByteToWideChar(httpClientIp);
+                params->AddParameter(L"CLIENTIP", clientIp); // NOXLATE
             }
             else if (NULL != httpXFF && strlen(httpXFF) > 0
                 && _stricmp(httpXFF, MapAgentStrings::Unknown) != 0)
             {
-                STRING wHttpXFF = MgUtil::MultiByteToWideChar(httpXFF);
-                params->AddParameter(L"CLIENTIP", wHttpXFF); // NOXLATE
+                clientIp = MgUtil::MultiByteToWideChar(httpXFF);
+                params->AddParameter(L"CLIENTIP", clientIp); // NOXLATE
             }
             else if (NULL != remoteAddr && strlen(remoteAddr) > 0)
             {
-                STRING wRemoteAddr = MgUtil::MultiByteToWideChar(remoteAddr);
-                params->AddParameter(L"CLIENTIP", wRemoteAddr); // NOXLATE
+                clientIp = MgUtil::MultiByteToWideChar(remoteAddr);
+                params->AddParameter(L"CLIENTIP", clientIp); // NOXLATE
             }
         }
 
@@ -197,6 +198,17 @@
             gotAuth = ParseAuth(auth, params);
         }
 
+        // Log request information
+        string postData = "";
+        if (requestMethod && _stricmp(requestMethod, "POST") == 0)  // NOXLATE
+        {
+            // Get the post xml data
+            postData = params->GetXmlPostData();
+        }
+
+        STRING client = params->GetParameterValue(MgHttpResourceStrings::reqClientAgent);
+        MapAgentCommon::LogRequest(client, clientIp, url, std::string(requestMethod), postData, std::string(query));
+
         Ptr<MgPropertyCollection> paramList = params->GetParameters()->GetPropertyCollection();
         if (paramList != NULL)
         {

Modified: sandbox/adsk/2.1/Web/src/HttpHandler/HttpUtil.cpp
===================================================================
--- sandbox/adsk/2.1/Web/src/HttpHandler/HttpUtil.cpp	2010-04-30 20:59:58 UTC (rev 4819)
+++ sandbox/adsk/2.1/Web/src/HttpHandler/HttpUtil.cpp	2010-04-30 21:50:01 UTC (rev 4820)
@@ -17,3 +17,72 @@
 
 #include "HttpHandler.h"
 #include "HttpUtil.h"
+
+void MgHttpUtil::LogException(MgException* exception)
+{
+    if(NULL != exception)
+    {
+        ACE_MT (ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, *ACE_Static_Object_Lock::instance()));
+
+        MgConfiguration* cfg = MgConfiguration::GetInstance();
+
+        // Is log enabled?
+        bool bLogEnabled = false;
+        cfg->GetBoolValue(MgConfigProperties::AgentPropertiesSection, MgConfigProperties::AgentErrorLogEnabled, bLogEnabled, MgConfigProperties::DefaultAgentErrorLogEnabled);
+
+        if(bLogEnabled)
+        {
+            // Get the logs path
+            STRING path = L"";
+            cfg->GetStringValue(MgConfigProperties::GeneralPropertiesSection, MgConfigProperties::GeneralPropertyLogsPath, path, MgConfigProperties::DefaultGeneralPropertyLogsPath);
+
+            // Check if path ends with a '/' if not, add one if needed
+            MgFileUtil::AppendSlashToEndOfPath(path);
+
+            STRING filename = L"";
+            cfg->GetStringValue(MgConfigProperties::AgentPropertiesSection, MgConfigProperties::AgentErrorLogFilename, filename, MgConfigProperties::DefaultAgentErrorLogFilename);
+            filename = path + filename;
+
+            FILE* fp = ACE_OS::fopen(MG_WCHAR_TO_TCHAR(filename), ACE_TEXT("a+"));
+            if (fp)
+            {
+                MgDateTime currentTime;
+                STRING strCurrentTime = currentTime.ToXmlString(false);
+
+                STRING message = exception->GetMessage();
+                STRING stackTrace = exception->GetStackTrace();
+                ACE_OS::fprintf(fp, ACE_TEXT("<%s>\n"), strCurrentTime.c_str());
+                ACE_OS::fprintf(fp, ACE_TEXT(" Error: %s\n"), message.c_str());
+
+                // Add the stack trace
+                // Do not log empty stack traces
+                if (!stackTrace.empty())
+                {
+                    STRING entry = L"";
+                    entry += L" " + MgResources::StackTrace + L":";
+
+                    size_t size = stackTrace.size();
+
+                    if (size > 0)
+                    {
+                        STRING trace = stackTrace.c_str();
+
+                        // Get rid of extra \n at the end of the stack trace
+                        if (trace[size-1] == L'\n')
+                        {
+                            trace.erase((size-1), 1);
+                        }
+
+                        // Make it look "pretty"
+                        trace = MgUtil::ReplaceString(trace, L"\n", L"\n  ");
+                        entry += L"\n  " + trace + L"\n";
+                    }
+
+                    ACE_OS::fprintf(fp, ACE_TEXT("%s"), entry.c_str());
+                }
+
+                ACE_OS::fclose(fp);
+            }
+        }
+    }
+}

Modified: sandbox/adsk/2.1/Web/src/HttpHandler/HttpUtil.h
===================================================================
--- sandbox/adsk/2.1/Web/src/HttpHandler/HttpUtil.h	2010-04-30 20:59:58 UTC (rev 4819)
+++ sandbox/adsk/2.1/Web/src/HttpHandler/HttpUtil.h	2010-04-30 21:50:01 UTC (rev 4820)
@@ -25,15 +25,20 @@
 
 #define MG_HTTP_HANDLER_CATCH(methodName)                                     \
     MG_CATCH(methodName)                                                      \
+    MgHttpUtil::LogException(mgException);                                    \
 
 #define MG_HTTP_HANDLER_THROW()                                               \
+    MgHttpUtil::LogException(mgException);                                    \
     MG_THROW()                                                                \
 
 #define MG_HTTP_HANDLER_CATCH_AND_THROW(methodName)                           \
-    MG_CATCH_AND_THROW(methodName)                                            \
+    MG_CATCH(methodName)                                                      \
+    MgHttpUtil::LogException(mgException);                                    \
+    MG_THROW()                                                                \
 
 #define MG_HTTP_HANDLER_CATCH_AND_THROW_EX(methodName)                        \
     MG_CATCH(methodName)                                                      \
+    MgHttpUtil::LogException(mgException);                                    \
                                                                               \
     if (mgException != NULL)                                                  \
     {                                                                         \
@@ -48,6 +53,7 @@
 
 #define MG_HTTP_HANDLER_CATCH_AND_THROW_EX2(methodName, hResult, hRequest)    \
     MG_CATCH(methodName)                                                      \
+    MgHttpUtil::LogException(mgException);                                    \
                                                                               \
     if (mgException != NULL)                                                  \
     {                                                                         \
@@ -60,4 +66,13 @@
         mgException->Raise();                                                 \
     }                                                                         \
 
+class MgHttpUtil
+{
+public:
+    MgHttpUtil();
+    ~MgHttpUtil();
+
+    static void LogException(MgException* exception);
+};
+
 #endif

Modified: sandbox/adsk/2.1/Web/src/IsapiAgent/IsapiAgent.cpp
===================================================================
--- sandbox/adsk/2.1/Web/src/IsapiAgent/IsapiAgent.cpp	2010-04-30 20:59:58 UTC (rev 4819)
+++ sandbox/adsk/2.1/Web/src/IsapiAgent/IsapiAgent.cpp	2010-04-30 21:50:01 UTC (rev 4820)
@@ -119,24 +119,25 @@
 
     // check for CLIENTIP, if it's not there (and it shouldn't be),
     // add it in using httpClientIp. httpXFF or remoteAddr
+    STRING clientIp = L"";
     if (!params->ContainsParameter(L"CLIENTIP")) // NOXLATE
     {
         if (bHttpClientIp && NULL != httpClientIp && strlen(httpClientIp) > 0
             && _stricmp(httpClientIp, MapAgentStrings::Unknown) != 0)
         {
-            STRING wHttpClientIp = MgUtil::MultiByteToWideChar(httpClientIp);
-            params->AddParameter(L"CLIENTIP", wHttpClientIp); // NOXLATE
+            clientIp = MgUtil::MultiByteToWideChar(httpClientIp);
+            params->AddParameter(L"CLIENTIP", clientIp); // NOXLATE
         }
         else if (bHttpXFF && NULL != httpXFF && strlen(httpXFF) > 0
             && _stricmp(httpXFF, MapAgentStrings::Unknown) != 0)
         {
-            STRING wHttpXFF = MgUtil::MultiByteToWideChar(httpXFF);
-            params->AddParameter(L"CLIENTIP", wHttpXFF); // NOXLATE
+            clientIp = MgUtil::MultiByteToWideChar(httpXFF);
+            params->AddParameter(L"CLIENTIP", clientIp); // NOXLATE
         }
         else if (bRemoteAddr && NULL != remoteAddr && strlen(remoteAddr) > 0)
         {
-            STRING wRemoteAddr = MgUtil::MultiByteToWideChar(remoteAddr);
-            params->AddParameter(L"CLIENTIP", wRemoteAddr); // NOXLATE
+            clientIp = MgUtil::MultiByteToWideChar(remoteAddr);
+            params->AddParameter(L"CLIENTIP", clientIp); // NOXLATE
         }
     }
 
@@ -154,6 +155,17 @@
         gotAuth = MapAgentCommon::ParseAuth(auth, params);
     }
 
+    // Log request information
+    string postData = "";
+    if (requestMethod && _stricmp(requestMethod, "POST") == 0)  // NOXLATE
+    {
+        // Get the post xml data
+        postData = params->GetXmlPostData();
+    }
+
+    STRING client = params->GetParameterValue(MgHttpResourceStrings::reqClientAgent);
+    MapAgentCommon::LogRequest(client, clientIp, url, std::string(requestMethod), postData, std::string(query));
+
     Ptr<MgPropertyCollection> paramList = params->GetParameters()->GetPropertyCollection();
     if (paramList != NULL)
     {

Modified: sandbox/adsk/2.1/Web/src/MapAgentCommon/MapAgentCommon.cpp
===================================================================
--- sandbox/adsk/2.1/Web/src/MapAgentCommon/MapAgentCommon.cpp	2010-04-30 20:59:58 UTC (rev 4819)
+++ sandbox/adsk/2.1/Web/src/MapAgentCommon/MapAgentCommon.cpp	2010-04-30 21:50:01 UTC (rev 4820)
@@ -261,3 +261,53 @@
     }
 }
 
+void MapAgentCommon::LogRequest(CREFSTRING client, CREFSTRING clientIp, std::string &url, std::string &requestMethod, std::string &postData, std::string &query)
+{
+    // Log request information
+    ACE_MT (ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, *ACE_Static_Object_Lock::instance()));
+    static INT32 requestId = 1;
+
+    MgConfiguration* cfg = MgConfiguration::GetInstance();
+
+    // Is log enabled?
+    bool bLogEnabled = false;
+    cfg->GetBoolValue(MgConfigProperties::AgentPropertiesSection, MgConfigProperties::AgentRequestLogEnabled, bLogEnabled, MgConfigProperties::DefaultAgentRequestLogEnabled);
+
+    if(bLogEnabled)
+    {
+        // Get the logs path
+        STRING path = L"";
+        cfg->GetStringValue(MgConfigProperties::GeneralPropertiesSection, MgConfigProperties::GeneralPropertyLogsPath, path, MgConfigProperties::DefaultGeneralPropertyLogsPath);
+
+        // Check if path ends with a '/' if not, add one if needed
+        MgFileUtil::AppendSlashToEndOfPath(path);
+
+        STRING filename = L"";
+        cfg->GetStringValue(MgConfigProperties::AgentPropertiesSection, MgConfigProperties::AgentRequestLogFilename, filename, MgConfigProperties::DefaultAgentRequestLogFilename);
+        filename = path + filename;
+
+        FILE* fp = ACE_OS::fopen(MG_WCHAR_TO_TCHAR(filename), ACE_TEXT("a+"));
+        if (fp)
+        {
+            MgDateTime currentTime;
+            STRING strCurrentTime = currentTime.ToXmlString(false);
+
+            ACE_OS::fprintf(fp, ACE_TEXT("<%s> %d\t%s\t%s\t%s\t%s\n"), strCurrentTime.c_str(), requestId, client.c_str(), clientIp.c_str(), MgUtil::MultiByteToWideChar(requestMethod).c_str(), MgUtil::MultiByteToWideChar(url).c_str());
+
+            if (!postData.empty())  // NOXLATE
+            {
+                ACE_OS::fprintf(fp, ACE_TEXT(" Postdata: %s\n"), MgUtil::MultiByteToWideChar(postData).c_str());
+            }
+
+            if (!query.empty())
+            {
+                ACE_OS::fprintf(fp, ACE_TEXT(" Query   : %s\n"), MgUtil::MultiByteToWideChar(query).c_str());
+            }
+
+            ACE_OS::fclose(fp);
+        }
+    }
+
+    // Increment the request Id
+    requestId++;
+}

Modified: sandbox/adsk/2.1/Web/src/MapAgentCommon/MapAgentCommon.h
===================================================================
--- sandbox/adsk/2.1/Web/src/MapAgentCommon/MapAgentCommon.h	2010-04-30 20:59:58 UTC (rev 4819)
+++ sandbox/adsk/2.1/Web/src/MapAgentCommon/MapAgentCommon.h	2010-04-30 21:50:01 UTC (rev 4820)
@@ -35,6 +35,8 @@
     static void ScanHeaders(char* partHdrStart, char* partHdrEnd, STRING& paramName, STRING& paramType, bool& bIsFile);
     static void PopulateData(char* partHdrEnd, char** curBuf, char* endBuf, string& dataEndTag,
         STRING& paramName, STRING& paramType, MgHttpRequestParam* params, bool& bIsFile);
+
+    static void LogRequest(CREFSTRING client, CREFSTRING clientIp, std::string &url, std::string &requestMethod, std::string &postData, std::string &query);
 };
 
 #endif

Modified: sandbox/adsk/2.1/Web/src/WebSupport/InitializeWebTier.cpp
===================================================================
--- sandbox/adsk/2.1/Web/src/WebSupport/InitializeWebTier.cpp	2010-04-30 20:59:58 UTC (rev 4819)
+++ sandbox/adsk/2.1/Web/src/WebSupport/InitializeWebTier.cpp	2010-04-30 21:50:01 UTC (rev 4820)
@@ -51,6 +51,16 @@
 
         resources->Initialize(resourcesPath);
         resources->LoadResources(locale);
+
+        // Get the logs path
+        STRING path = L"";
+        config->GetStringValue(MgConfigProperties::GeneralPropertiesSection, MgConfigProperties::GeneralPropertyLogsPath, path, MgConfigProperties::DefaultGeneralPropertyLogsPath);
+
+        // Check if path ends with a '/' if not, add one if needed
+        MgFileUtil::AppendSlashToEndOfPath(path);
+
+        // Try and create the directory. If it already exists this will error and not a problem
+        ACE_OS::mkdir(MG_WCHAR_TO_TCHAR(path));
     }
 
     m_bInitialized = true;

Modified: sandbox/adsk/2.1/Web/src/webconfig.ini
===================================================================
--- sandbox/adsk/2.1/Web/src/webconfig.ini	2010-04-30 20:59:58 UTC (rev 4819)
+++ sandbox/adsk/2.1/Web/src/webconfig.ini	2010-04-30 21:50:01 UTC (rev 4820)
@@ -39,12 +39,14 @@
 #                                           case and the last 2 characters must
 #                                           be upper case.
 #
+# LogsPath                         Path where log files are stored
 # ResourcesPath                    Path where the localization resource files are stored
 # TcpIpMtu                         The TCP/IP maximum transmission unit
 #                                       0 < Value <= 65535
 # TempPath                         Path where the temporary files are stored
 # *****************************************************************************
 DefaultMessageLocale               = en
+LogsPath                           = Logs/
 ResourcesPath                      = Resources/
 TcpIpMtu                           = 1460
 TempPath                           = Temp/
@@ -115,11 +117,19 @@
 #                                       0 = false and 1 = true
 # DisableWms                       Disables OGC Wms HTTP requests
 #                                       0 = false and 1 = true
+# ErrorLogEnabled                  0 = log disabled, 1 = log enabled
+# ErrorLogFilename                 Name of the log file
+# RequestLogEnabled                0 = log disabled, 1 = log enabled
+# RequestLogFilename               Name of the log file
 # *****************************************************************************
 DebugPause                         = 0
 DisableAuthoring                   = 0
 DisableWfs                         = 0
 DisableWms                         = 0
+ErrorLogEnabled                    = 1
+ErrorLogFilename                   = Error.log
+RequestLogEnabled                  = 0
+RequestLogFilename                 = Request.log
 
 [OgcProperties]
 # *****************************************************************************



More information about the mapguide-commits mailing list