git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@3460
48e7efb5-ca39-0410-a469-
dd3cf9ba447f
killall 06-logs_server 06-logs_client 2>/dev/null || true
06-logs.output.verbose: 06-logs_client 06-logs_server 06-logs_simulator
killall 06-logs_server 06-logs_client 2>/dev/null || true
06-logs.output.verbose: 06-logs_client 06-logs_server 06-logs_simulator
- echo '$$ ./test_server 12345 --gras-log=test.thres=verbose & ./test_client 127.0.0.1 12345 --gras-log=test.thres=verbose' > $@
- ./06-logs_server 12345 --gras-log=test.thres=verbose 2>&1 |sed s/06-logs/test/ >> $@ 2>&1&
- ./06-logs_client 127.0.0.1 12345 --gras-log=test.thres=verbose 2>&1 |sed s/06-logs/test/ >> $@ 2>&1
+ echo '$$ ./test_server 12345 --gras-log=test.thres:verbose & ./test_client 127.0.0.1 12345 --gras-log=test.thres:verbose' > $@
+ ./06-logs_server 12345 --gras-log=test.thres:verbose 2>&1 |sed s/06-logs/test/ >> $@ 2>&1&
+ ./06-logs_client 127.0.0.1 12345 --gras-log=test.thres:verbose 2>&1 |sed s/06-logs/test/ >> $@ 2>&1
- echo '$$ ./test_simulator platform.xml test.xml --gras-log=test.thres=verbose' >> $@
- ./06-logs_simulator gtut-platform.xml 03-args.xml --gras-log=test.thres=verbose 2>&1 |sed s/06-logs/test/ >> $@ 2>&1
+ echo '$$ ./test_simulator platform.xml test.xml --gras-log=test.thres:verbose' >> $@
+ ./06-logs_simulator gtut-platform.xml 03-args.xml --gras-log=test.thres:verbose 2>&1 |sed s/06-logs/test/ >> $@ 2>&1
echo '$$' >> $@
killall 06-logs_server 06-logs_client 2>/dev/null || true
06-logs.output.error: 06-logs_client 06-logs_server 06-logs_simulator
echo '$$' >> $@
killall 06-logs_server 06-logs_client 2>/dev/null || true
06-logs.output.error: 06-logs_client 06-logs_server 06-logs_simulator
- echo '$$ ./test_server 12345 --gras-log=root.thres=error & ./test_client 127.0.0.1 12345 --gras-log=root.thres=error' > $@
- ./06-logs_server 12345 --gras-log=root.thres=error 2>&1 |sed s/06-logs/test/ >> $@ 2>&1&
- ./06-logs_client 127.0.0.1 12345 --gras-log=root.thres=error 2>&1 |sed s/06-logs/test/ >> $@ 2>&1
+ echo '$$ ./test_server 12345 --gras-log=root.thres:error & ./test_client 127.0.0.1 12345 --gras-log=root.thres:error' > $@
+ ./06-logs_server 12345 --gras-log=root.thres:error 2>&1 |sed s/06-logs/test/ >> $@ 2>&1&
+ ./06-logs_client 127.0.0.1 12345 --gras-log=root.thres:error 2>&1 |sed s/06-logs/test/ >> $@ 2>&1
- echo '$$ ./test_simulator platform.xml test.xml --gras-log=root.thres=error' >> $@
- ./06-logs_simulator gtut-platform.xml 03-args.xml --gras-log=root.thres=error 2>&1 |sed s/06-logs/test/ >> $@ 2>&1
+ echo '$$ ./test_simulator platform.xml test.xml --gras-log=root.thres:error' >> $@
+ ./06-logs_simulator gtut-platform.xml 03-args.xml --gras-log=root.thres:error 2>&1 |sed s/06-logs/test/ >> $@ 2>&1
echo '$$' >> $@
killall 06-logs_server 06-logs_client 2>/dev/null || true
echo '$$' >> $@
killall 06-logs_server 06-logs_client 2>/dev/null || true
int main() {
/ * Now set the parent's priority. (the string would typcially be a runtime option) * /
int main() {
/ * Now set the parent's priority. (the string would typcially be a runtime option) * /
- xbt_log_control_set("SA.thresh=3");
+ xbt_log_control_set("SA.thresh:3");
/ * This request is enabled, because WARNING >= INFO. * /
CWARN2(VSS, "Low fuel level.");
/ * This request is enabled, because WARNING >= INFO. * /
CWARN2(VSS, "Low fuel level.");
are synonyms provided by aestheticism). You can provide several of those
arguments to change the setting of several categories, they will be applied
from left to right. So,
are synonyms provided by aestheticism). You can provide several of those
arguments to change the setting of several categories, they will be applied
from left to right. So,
-\verbatim --xbt-log="root.thres=debug root.thres=critical"\endverbatim
+\verbatim --xbt-log="root.thres:debug root.thres:critical"\endverbatim
should disable any logging.
Note that the quotes on above line are mandatory because there is a space in
the argument, so we are protecting ourselves from the shell, not from SimGrid.
We could also reach the same effect with this:
should disable any logging.
Note that the quotes on above line are mandatory because there is a space in
the argument, so we are protecting ourselves from the shell, not from SimGrid.
We could also reach the same effect with this:
-\verbatim --xbt-log=root.thres=debug --xbt-log=root.thres=critical\endverbatim
+\verbatim --xbt-log=root.thres:debug --xbt-log=root.thres:critical\endverbatim
\section log_use_misc 3.2 Misc and Caveats
\section log_use_misc 3.2 Misc and Caveats
typedef struct {
char *catname;
e_xbt_log_priority_t thresh;
typedef struct {
char *catname;
e_xbt_log_priority_t thresh;
XBT_LOG_NEW_CATEGORY(simix,"All SIMIX categories");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(log,xbt,"Loggings from the logging mechanism itself");
XBT_LOG_NEW_CATEGORY(simix,"All SIMIX categories");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(log,xbt,"Loggings from the logging mechanism itself");
+/** @brief Get all logging settings from the command line
+ *
+ * xbt_log_control_set() is called on each string we got from cmd line
+ */
void xbt_log_init(int *argc,char **argv) {
int i,j;
char *opt;
void xbt_log_init(int *argc,char **argv) {
int i,j;
char *opt;
name = control_string;
control_string += strcspn(control_string, ".= ");
dot = control_string;
name = control_string;
control_string += strcspn(control_string, ".= ");
dot = control_string;
- control_string += strcspn(control_string, "= ");
+ control_string += strcspn(control_string, ":= ");
eq = control_string;
control_string += strcspn(control_string, " ");
eq = control_string;
control_string += strcspn(control_string, " ");
- xbt_assert1(*dot == '.' && *eq == '=',
+ xbt_assert1(*dot == '.' && (*eq == '=' || *eq == ':'),
"Invalid control string '%s'",control_string);
if (!strncmp(dot + 1, "thresh", min((size_t)(eq - dot - 1),strlen("thresh")))) {
"Invalid control string '%s'",control_string);
if (!strncmp(dot + 1, "thresh", min((size_t)(eq - dot - 1),strlen("thresh")))) {
static xbt_log_category_t _xbt_log_cat_searchsub(xbt_log_category_t cat,char *name) {
xbt_log_category_t child;
static xbt_log_category_t _xbt_log_cat_searchsub(xbt_log_category_t cat,char *name) {
xbt_log_category_t child;
-
- if (!strcmp(cat->name,name)) {
+ if (!strcmp(cat->name,name))
- }
- for(child=cat->firstChild ; child != NULL; child = child->nextSibling) {
+
+ for(child=cat->firstChild ; child != NULL; child = child->nextSibling)
return _xbt_log_cat_searchsub(child,name);
return _xbt_log_cat_searchsub(child,name);
- THROW0(not_found_error,0,"No such category");
+ THROW1(not_found_error,0,"No such category: %s", name);
*
* Typically passed a command-line argument. The string has the syntax:
*
*
* Typically passed a command-line argument. The string has the syntax:
*
- * ( [category] "." [keyword] "=" value (" ")... )...
+ * ( [category] "." [keyword] ":" value (" ")... )...
*
* where [category] is one the category names (see \ref XBT_log_cats for a complete list)
* and keyword is one of the following:
*
* where [category] is one the category names (see \ref XBT_log_cats for a complete list)
* and keyword is one of the following:
* - thres: category's threshold priority. Possible values:
* TRACE,DEBUG,VERBOSE,INFO,WARNING,ERROR,CRITICAL
*
* - thres: category's threshold priority. Possible values:
* TRACE,DEBUG,VERBOSE,INFO,WARNING,ERROR,CRITICAL
*
- *
- * \warning
- * This routine may only be called once and that must be before any other
- * logging command! Typically, this is done from main().
- * \todo the previous warning seems a bit old and need double checking
*/
void xbt_log_control_set(const char* control_string) {
xbt_log_setting_t set;
char *cs;
char *p;
int done = 0;
*/
void xbt_log_control_set(const char* control_string) {
xbt_log_setting_t set;
char *cs;
char *p;
int done = 0;
+
+ if (!control_string || control_string[0] == '\0')
+ return;
DEBUG1("Parse log settings '%s'",control_string);
if (control_string == NULL)
return;
DEBUG1("Parse log settings '%s'",control_string);
if (control_string == NULL)
return;