[prev in list] [next in list] [prev in thread] [next in thread] 

List:       helix-server-cvs
Subject:    [Server-cvs] log/tmplgpln base_log.cpp, 1.58, 1.58.20.1 base_log.h, 1.17, 1.17.20.1 error_log.cpp, 1
From:       yijil () helixcommunity ! org
Date:       2013-03-25 10:41:43
[Download RAW message or body]

Update of /cvsroot/server/log/tmplgpln
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv15541/server/log/tmplgpln

Modified Files:
      Tag: SERVER_VHOST_YIJI_2
	base_log.cpp base_log.h error_log.cpp error_log.h 
Log Message:
Committed to: SERVER_VHOST_YIJI_2

Reviewed by: Xiaocheng

Synopsis
========
Configure file and Error log(including updates for common part) for vhost support

Branches: SERVER_VHOST_YIJI_2

Reviewer: Anyone

Description
===========
I. Configuration
In current server design, when server starts, it will load rmserver.cfg file, and \
save it to our server registry. In registry, every item in rmserver.cfg will under \
root config, when any updates from admin page, it will cause items bellow config be \
write back it rmserver.cfg.

In the version for vhost, there exists one configure file for every account. We put \
every configure file data of different vhost (for example Account) under \
vhost.Account in registry.

Use a map to manage multiple vhost configure file, it will have interfaces to \
search/save XMLConfig object by account name.

II. Error log
In version supporting vhost, it needs to separate logs according to vhost account.

Add a new interface "IHXErrorMessage2" for saving vhost log. When other parts want to \
save vhost error log, they don`t need to change other parts, only need query \
interface IHXErrorMessage2 and call IHXErrorMessage2::ReportByVhost().

There CR also include delete or add vhost account.

III. Files Affected
==============
common/include/hxiids.h
common/include/hxerror.h
common/include/hxcfg.h
server/engine/core/proc_container.cpp
server/engine/core/server_context.cpp
server/engine/core/pub/error_sink_handler.h
server/engine/core/pub/proc_container.h
server/engine/context/errhand.cpp
server/engine/context/pub/errhand.h
server/engine/context/pub/error_sink_ctrl.h
server/engine/config/config.cpp
server/engine/config/xmlregconfig.cpp
server/engine/config/pub/xmlregconfig.h
server/log/tmplgpln/base_log.cpp
server/log/tmplgpln/base_log.h
server/log/tmplgpln/error_log.cpp
server/log/tmplgpln/error_log.h
server/log/tmplgpln/tmplgpln.cpp
server/log/tmplgpln/tmplgpln.h

Testing Performed
=================



Index: base_log.cpp
===================================================================
RCS file: /cvsroot/server/log/tmplgpln/base_log.cpp,v
retrieving revision 1.58
retrieving revision 1.58.20.1
diff -u -d -r1.58 -r1.58.20.1
--- base_log.cpp	13 Feb 2012 22:39:37 -0000	1.58
+++ base_log.cpp	25 Mar 2013 10:41:26 -0000	1.58.20.1
@@ -104,6 +104,7 @@
 , m_pName(NULL)
 , m_pFormat(NULL)
 , m_bEnabled(TRUE)
+, m_ulGrandFatherId(0)
 , m_ulLogRootRegId(0)
 , m_ulFormatRegId(0)
 , m_ulEnableFlagRegId(0)

Index: error_log.cpp
===================================================================
RCS file: /cvsroot/server/log/tmplgpln/error_log.cpp,v
retrieving revision 1.6
retrieving revision 1.6.44.1
diff -u -d -r1.6 -r1.6.44.1
--- error_log.cpp	19 Mar 2010 21:35:39 -0000	1.6
+++ error_log.cpp	25 Mar 2013 10:41:26 -0000	1.6.44.1
@@ -87,6 +87,15 @@
 {
 }
 
+CTErrorLog::CTErrorLog(const char* pVhostAccount)
+: CTBaseLog()
+, m_pErrorSinkControl(NULL)
+{
+    if (pVhostAccount)
+    {
+        m_sVhostAccount = pVhostAccount;
+    }
+}
 
 ///////////////////////////////////////////////////////////////////////////////
 // CTErrorLog::~CTErrorLog()
@@ -325,6 +334,36 @@
 
 
     UINT32 ulProcessNumber = 0;
+    CHXString sErrorType;
+    switch (ulSeverity)
+    {
+    case HXLOG_EMERG:
+        sErrorType = TYPE_LOG_EMERG;
+        break;
+    case HXLOG_ALERT:
+        sErrorType = TYPE_LOG_ALERT;
+        break;
+    case HXLOG_CRIT:
+        sErrorType = TYPE_LOG_CRIT;
+        break;
+    case HXLOG_ERR:
+        sErrorType = TYPE_LOG_ERR;
+        break;
+    case HXLOG_WARNING:
+        sErrorType = TYPE_LOG_WARNING;
+        break;
+    case HXLOG_NOTICE:
+        sErrorType = TYPE_LOG_NOTICE;
+        break;
+    case HXLOG_INFO:
+        sErrorType = TYPE_LOG_INFO;
+        break;
+    case HXLOG_DEBUG:
+        sErrorType = TYPE_LOG_DEBUG;
+        break;
+    default:
+        break;
+    }
     
 #if (defined _MACINTOSH)
 
@@ -347,8 +386,8 @@
 
     snprintf(szFormat, 
              ulFormatLength, 
-             "%s%%%s%%-%%%s%%-%%%s%% %%%s%%:%%%s%%:%%%s%%.%%%s%% %s(%u): %s%s",
-             ulSeverity < HXLOG_ERR ? "***" : "",
+             "%s:%%%s%%-%%%s%%-%%%s%% %%%s%%:%%%s%%:%%%s%%.%%%s%% %s(%u): %s%s",
+             (const char*)sErrorType,
              FORMAT_DAY,
              FORMAT_ABBREVMONTH,
              FORMAT_YEAR,
@@ -390,12 +429,26 @@
 void
 CTErrorLog::StartLogging()
 {
-   m_pErrorSinkControl->AddErrorSink(this, 
-                                     HXLOG_EMERG, 
-                                     HXLOG_INFO);
+    if (m_sVhostAccount.IsEmpty())
+    {
+       m_pErrorSinkControl->AddErrorSink(this, 
+                                         HXLOG_EMERG, 
+                                         HXLOG_INFO);
+    }
+    else
+    {
+        IHXErrorSinkControl2* pErrorSink = NULL;
+        if (HXR_OK == m_pErrorSinkControl->QueryInterface(IID_IHXErrorSinkControl2, \
(void**)&pErrorSink) && pErrorSink) +        {
+            pErrorSink->AddVhostErrorSink(this, 
+                                         HXLOG_EMERG, 
+                                         HXLOG_INFO,
+                                         (const char*)m_sVhostAccount);
+        }
+        HX_RELEASE(pErrorSink);
+    }
 }
 
-
 ///////////////////////////////////////////////////////////////////////////////
 // CTErrorLog::StopLogging()
 ///////////////////////////////////////////////////////////////////////////////
@@ -405,7 +458,19 @@
 {
     if (m_pErrorSinkControl)
     {
-	m_pErrorSinkControl->RemoveErrorSink(this);
+        if (m_sVhostAccount.IsEmpty())
+        {
+            m_pErrorSinkControl->RemoveErrorSink(this);
+        }
+        else
+        {
+            IHXErrorSinkControl2* pErrorSink = NULL;
+            if (HXR_OK == \
m_pErrorSinkControl->QueryInterface(IID_IHXErrorSinkControl2, (void**)&pErrorSink) && \
pErrorSink) +            {
+                pErrorSink->RemoveVhostErrorSink((const char*)m_sVhostAccount);
+            }
+            HX_RELEASE(pErrorSink);
+        }
     }
 }
 

Index: error_log.h
===================================================================
RCS file: /cvsroot/server/log/tmplgpln/error_log.h,v
retrieving revision 1.3
retrieving revision 1.3.188.1
diff -u -d -r1.3 -r1.3.188.1
--- error_log.h	29 Jan 2007 23:57:54 -0000	1.3
+++ error_log.h	25 Mar 2013 10:41:26 -0000	1.3.188.1
@@ -65,6 +65,7 @@
 public:
 
     CTErrorLog();
+    CTErrorLog(const char* pVhostAccount);
     ~CTErrorLog();
     
 
@@ -101,6 +102,8 @@
 
     virtual void StartLogging();
     virtual void StopLogging();
+private:
+    CHXString                               m_sVhostAccount;
 };
 
 

Index: base_log.h
===================================================================
RCS file: /cvsroot/server/log/tmplgpln/base_log.h,v
retrieving revision 1.17
retrieving revision 1.17.20.1
diff -u -d -r1.17 -r1.17.20.1
--- base_log.h	21 Dec 2011 03:30:01 -0000	1.17
+++ base_log.h	25 Mar 2013 10:41:26 -0000	1.17.20.1
@@ -233,6 +233,7 @@
     
 // Registry ID's of config variables.    
 
+    UINT32 m_ulGrandFatherId;           // Registry ID of this log`s grand father
     UINT32 m_ulLogRootRegId;            // Registry ID of this log's root key.
     UINT32 m_ulOutputRootRegId;         // Registry ID of this log's outputs.
     UINT32 m_ulEnableFlagRegId;         // Registry ID of this log's enable flag.
@@ -345,7 +346,15 @@
     void SetEnableFlagRegId(UINT32 ulNewId) { m_ulEnableFlagRegId = ulNewId; }
     
     UINT32 GetLogRootRegId() { return m_ulLogRootRegId; } 
-    void SetLogRootRegId(UINT32 ulNewId) { m_ulLogRootRegId = ulNewId; }
+    void SetLogRootRegId(UINT32 ulNewId) 
+    {
+        m_ulLogRootRegId = ulNewId;
+        if (m_pRegistry)
+        {
+            m_ulGrandFatherId = \
m_pRegistry->FindParentIdById(m_pRegistry->FindParentIdById(m_ulLogRootRegId)); +     \
} +    }
+    UINT32 GetGrandFatherRootRegId() { return m_ulGrandFatherId; }
     
     UINT32 GetOutputRootRegId() { return m_ulOutputRootRegId; } 
     void SetOutputRootRegId(UINT32 ulNewId) { m_ulOutputRootRegId = ulNewId; }


_______________________________________________
Server-cvs mailing list
Server-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/server-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic