[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[myserver-commit] [2954] Simplified the `virtualhosts.xml' file syntax a
From: |
Francesco Pipita |
Subject: |
[myserver-commit] [2954] Simplified the `virtualhosts.xml' file syntax about the log management options. |
Date: |
Mon, 10 Nov 2008 10:27:09 +0000 |
Revision: 2954
http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2954
Author: francesco_pipita
Date: 2008-11-10 10:27:08 +0000 (Mon, 10 Nov 2008)
Log Message:
-----------
Simplified the `virtualhosts.xml' file syntax about the log management options.
Modified Paths:
--------------
trunk/myserver/binaries/virtualhosts.xml.default
trunk/myserver/binaries/virtualhosts.xml.unix.default
trunk/myserver/documentation/log_management.texi
trunk/myserver/src/conf/vhost/vhost_manager.cpp
Modified: trunk/myserver/binaries/virtualhosts.xml.default
===================================================================
--- trunk/myserver/binaries/virtualhosts.xml.default 2008-11-09 22:35:20 UTC
(rev 2953)
+++ trunk/myserver/binaries/virtualhosts.xml.default 2008-11-10 10:27:08 UTC
(rev 2954)
@@ -10,22 +10,13 @@
<DOCROOT>web</DOCROOT>
<SYSFOLDER>system</SYSFOLDER>
-
+
<ACCESSLOG>
- <STREAMS>
- <STREAM>
- <LOCATION>file://logs/MyServerHTTP.log</LOCATION>
- <CYCLE>1048576</CYCLE>
- </STREAM>
- </STREAMS>
+ <STREAM location="file://logs/MyServerHTTP.log"
cycle="1048576"/>
</ACCESSLOG>
- <WARNINGLOG>
- <STREAMS>
- <STREAM>
- <LOCATION>file://logs/MyServerHTTP.err</LOCATION>
- <CYCLE>1048576</CYCLE>
- </STREAM>
- </STREAMS>
+
+ <WARNINGLOG>
+ <STREAM location="file://logs/MyServerHTTP.err"
cycle="1048576"/>
</WARNINGLOG>
</VHOST>
@@ -39,20 +30,11 @@
<SYSFOLDER>system</SYSFOLDER>
<ACCESSLOG>
- <STREAMS>
- <STREAM>
- <LOCATION>file://logs/MyServerFTP.log</LOCATION>
- <CYCLE>1048576</CYCLE>
- </STREAM>
- </STREAMS>
+ <STREAM location="file://logs/MyServerFTP.log"
cycle="1048576"/>
</ACCESSLOG>
+
<WARNINGLOG>
- <STREAMS>
- <STREAM>
- <LOCATION>file://logs/MyServerFTP.err</LOCATION>
- <CYCLE>1048576</CYCLE>
- </STREAM>
- </STREAMS>
+ <STREAM location="file://logs/MyServerFTP.err"
cycle="1048576"/>
</WARNINGLOG>
</VHOST>
</VHOSTS>
Modified: trunk/myserver/binaries/virtualhosts.xml.unix.default
===================================================================
--- trunk/myserver/binaries/virtualhosts.xml.unix.default 2008-11-09
22:35:20 UTC (rev 2953)
+++ trunk/myserver/binaries/virtualhosts.xml.unix.default 2008-11-10
10:27:08 UTC (rev 2954)
@@ -12,21 +12,12 @@
<SYSFOLDER>/usr/local/share/myserver/system/</SYSFOLDER>
<ACCESSLOG>
- <STREAMS>
- <STREAM>
-
<LOCATION>file:///var/log/myserver/MyServerHTTP.log</LOCATION>
- <CYCLE>1048576</CYCLE>
- </STREAM>
- </STREAMS>
- </ACCESSLOG>
- <WARNINGLOG>
- <STREAMS>
- <STREAM>
-
<LOCATION>file:///var/log/myserver/MyServerHTTP.err</LOCATION>
- <CYCLE>1048576</CYCLE>
- </STREAM>
- </STREAMS>
- </WARNINGLOG>
+ <STREAM location="file:///var/log/myserver/MyServerHTTP.log"
cycle="1048576"/>
+ </ACCESSLOG>
+
+ <WARNINGLOG>
+ <STREAM location="file:///var/log/myserver/MyServerHTTP.err"
cycle="1048576"/>
+ </WARNINGLOG>
</VHOST>
<VHOST>
@@ -39,20 +30,11 @@
<SYSFOLDER>/usr/local/share/myserver/system/</SYSFOLDER>
<ACCESSLOG>
- <STREAMS>
- <STREAM>
-
<LOCATION>file:///var/log/myserver/MyServerFTP.log</LOCATION>
- <CYCLE>1048576</CYCLE>
- </STREAM>
- </STREAMS>
- </ACCESSLOG>
+ <STREAM location="file:///var/log/myserver/MyServerFTP.log"
cycle="1048576"/>
+ </ACCESSLOG>
+
<WARNINGLOG>
- <STREAMS>
- <STREAM>
-
<LOCATION>file:///var/log/myserver/MyServerFTP.err</LOCATION>
- <CYCLE>1048576</CYCLE>
- </STREAM>
- </STREAMS>
- </WARNINGLOG>
+ <STREAM location="file:///var/log/myserver/MyServerFTP.err"
cycle="1048576"/>
+ </WARNINGLOG>
</VHOST>
</VHOSTS>
Modified: trunk/myserver/documentation/log_management.texi
===================================================================
--- trunk/myserver/documentation/log_management.texi 2008-11-09 22:35:20 UTC
(rev 2953)
+++ trunk/myserver/documentation/log_management.texi 2008-11-10 10:27:08 UTC
(rev 2954)
@@ -59,23 +59,17 @@
can edit the @file{virtualhosts.xml} file, and apply the informations
found in this section, to each @code{VHOST} entry of that file. As we
can see in the following example, the @code{ACCESSLOG} root entry for
-the accesses log configuration, contains some @code{STREAMS}, and each
address@hidden is made out of a @code{LOCATION}, a @code{CYCLE} and some
address@hidden
+the accesses log configuration, contains some @code{STREAM} nodes, and
+each @code{STREAM} contains two attributes, the mandatory
address@hidden and the optional @code{cycle}. A @code{STREAM} node, can
+also contain optional @code{FILTER} subnodes, one for each filter that
+we want to add to the @code{STREAM}.
@example
<ACCESSLOG type="combined">
- <STREAMS>
- <STREAM>
- <LOCATION>file://logs/MyServerHTTP.log</LOCATION>
- <CYCLE>1048576</CYCLE>
- <FILTERS>
- <FILTER>gzip</FILTER>
- </FILTERS>
- </STREAM>
- <STREAM>
- <LOCATION>console://stderr</LOCATION>
- </STREAM>
- </STREAMS>
+ <STREAM location="file://logs/MyServerHTTP.log" cycle="1048576">
+ <FILTER>gzip</FILTER>
+ </STREAM>
+ <STREAM location="console://stderr"/>
</ACCESSLOG>
@end example
Above we have two streams attached to the @code{ACCESSLOG} entry. The
@@ -87,18 +81,15 @@
example, we still have two streams where warning messages will be
sent. The first one is a socket, while the second one is a file that
will grow with no limit over its size. No filters will be applied to
-that stream.
+that stream. Note that if we don't specify the @code{cycle} attribute,
+it is assumed to be zero by default, which means to never cycle the
address@hidden
@example
<WARNINGLOG>
- <STREAMS>
- <STREAM>
- <LOCATION>socket://192.168.1.13:8080</LOCATION>
- </STREAM>
- <STREAM>
- <LOCATION>file://MyServerHTTP.err</LOCATION>
- </STREAM>
- </STREAMS>
+ <STREAM location="socket://192.168.1.13:8080"/>
+ <STREAM location="file://MyServerHTTP.err"/>
</WARNINGLOG>
@end example
It is important to notice that no duplicate location strings are
-admitted. If any, only the first one will be added.
+admitted. If any, only the first one will be added. Also, if a wrong
+filter is specified, its relative @code{STREAM} willn't be added.
Modified: trunk/myserver/src/conf/vhost/vhost_manager.cpp
===================================================================
--- trunk/myserver/src/conf/vhost/vhost_manager.cpp 2008-11-09 22:35:20 UTC
(rev 2953)
+++ trunk/myserver/src/conf/vhost/vhost_manager.cpp 2008-11-10 10:27:08 UTC
(rev 2954)
@@ -244,100 +244,69 @@
attr = lcur->properties;
while (attr)
{
- opt.append((char*)attr->name);
- opt.append("=");
- opt.append((char*)attr->children->content);
- if(attr->next)
+ opt.append ((char*)attr->name);
+ opt.append ("=");
+ opt.append ((char*)attr->children->content);
+ if (attr->next)
{
- opt.append(",");
+ opt.append (",");
}
attr = attr->next;
}
string location;
list<string> filters;
u_long cycle;
- xmlNode* streams = lcur->children;
- for (; streams->next; streams = streams->next)
+ xmlNode* stream = lcur->children;
+ for (; stream; stream = stream->next, location.assign (""), cycle = 0,
filters.clear ())
{
- if (streams->type == XML_ELEMENT_NODE &&
- !xmlStrcmp (streams->name, (const xmlChar*)"STREAMS"))
+ if (stream->type == XML_ELEMENT_NODE &&
+ !xmlStrcmp (stream->name, (xmlChar const*)"STREAM"))
{
- xmlNode* currStream = streams->children;
- for (; currStream->next; currStream = currStream->next)
+ xmlAttr* streamAttr = stream->properties;
+ while (streamAttr)
{
- if (currStream->type == XML_ELEMENT_NODE &&
- !xmlStrcmp (currStream->name, (const xmlChar*)"STREAM"))
+ if (!strcmp ((char*)streamAttr->name, "location"))
{
- xmlNode* parameters = currStream->children;
- location.assign ("");
- filters.clear ();
- cycle = 0;
- for (; parameters->next; parameters = parameters->next)
+ location.assign ((char*)streamAttr->children->content);
+ }
+ else if (!strcmp ((char*)streamAttr->name, "cycle"))
+ {
+ cycle = atoi ((char*)streamAttr->children->content);
+ }
+ streamAttr = streamAttr->next;
+ }
+ xmlNode* filterList = stream->children;
+ for (; filterList; filterList = filterList->next)
+ {
+ if (filterList->type == XML_ELEMENT_NODE &&
+ !xmlStrcmp (filterList->name, (xmlChar const*)"FILTER"))
+ {
+ if (filterList->children && filterList->children->content)
{
- if (parameters->type == XML_ELEMENT_NODE)
- {
- if (!xmlStrcmp (parameters->name,
- (const xmlChar*)"LOCATION"))
- {
- if (parameters->children &&
- parameters->children->content)
- {
- location.assign
((char*)parameters->children->content);
- }
- }
- else if (!xmlStrcmp (parameters->name,
- (const xmlChar*)"CYCLE"))
- {
- if (parameters->children &&
- parameters->children->content)
- {
- cycle = atoi
((char*)parameters->children->content);
- }
- }
- else if (!xmlStrcmp (parameters->name,
- (const xmlChar*)"FILTERS"))
- {
- xmlNode* filterList = parameters->children;
- for (; filterList; filterList = filterList->next)
- {
- if (filterList->type == XML_ELEMENT_NODE)
- {
- if (!xmlStrcmp (filterList->name,
- (const
xmlChar*)"FILTER"))
- {
- if (filterList->children &&
- filterList->children->content)
- {
- string filter
((char*)filterList->children->content);
- filters.push_back (filter);
- }
- }
- }
- }
- }
- }
+ string filter ((char*)filterList->children->content);
+ filters.push_back (filter);
}
- int err = 1;
- string str ("VhostManager::loadXMLlogData : Unrecognized log
type");
-
- if (!name.compare ("ACCESSLOG"))
- {
- err = vh->openAccessLog (location, filters, cycle);
- vh->setAccessLogOpt (opt.c_str ());
- str.assign ("Error opening accesses log location " +
location);
- }
- else if (!name.compare ("WARNINGLOG"))
- {
- err = vh->openWarningLog (location, filters, cycle);
- vh->setWarningLogOpt (opt.c_str ());
- str.assign ("Error opening warnings log location " +
location);
- }
- if (err)
- {
- Server::getInstance ()->logWriteln (str.c_str (),
MYSERVER_LOG_MSG_ERROR);
- }
}
}
+ int err = 1;
+ string str ("VhostManager::loadXMLlogData : Unrecognized log type");
+
+ if (!name.compare ("ACCESSLOG"))
+ {
+ err = vh->openAccessLog (location, filters, cycle);
+ vh->setAccessLogOpt (opt.c_str ());
+ str.assign ("Error opening accesses log location " + location);
+ }
+ else if (!name.compare ("WARNINGLOG"))
+ {
+ err = vh->openWarningLog (location, filters, cycle);
+ vh->setWarningLogOpt (opt.c_str ());
+ str.assign ("Error opening warnings log location " + location);
+ }
+ if (err)
+ {
+ Server::getInstance ()->logWriteln (str.c_str (),
MYSERVER_LOG_MSG_ERROR);
+ }
}
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [myserver-commit] [2954] Simplified the `virtualhosts.xml' file syntax about the log management options.,
Francesco Pipita <=