Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Do not truncate the output on large messages, but switch to a dynamically allocated...
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 12 Oct 2007 08:19:46 +0000 (08:19 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 12 Oct 2007 08:19:46 +0000 (08:19 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@4812 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/xbt/log.c
src/xbt/log_private.h
src/xbt/xbt_log_layout_format.c
src/xbt/xbt_log_layout_simple.c
teshsuite/Makefile.am
teshsuite/Makefile.in
teshsuite/xbt/log_large_test.c [new file with mode: 0644]
teshsuite/xbt/log_large_test.tesh [new file with mode: 0644]

index db558b7..d158ee5 100644 (file)
@@ -582,12 +582,12 @@ void _xbt_log_event_log( xbt_log_event_t ev, const char *fmt, ...) {
   }
    
   va_start(ev->ap, fmt);
+  va_start(ev->ap_copy, fmt);
   while(1) {
     xbt_log_appender_t appender = cat->appender;
     if (appender != NULL) {
       xbt_assert1(cat->layout,"No valid layout for the appender of category %s",cat->name);
-      cat->layout->do_layout(cat->layout, ev, fmt);
-      appender->do_append(appender, ev->buffer);
+      cat->layout->do_layout(cat->layout, ev, fmt, appender);
     }
     if (!cat->additivity)
       break;
@@ -595,6 +595,7 @@ void _xbt_log_event_log( xbt_log_event_t ev, const char *fmt, ...) {
     cat = cat->parent;
   } 
   va_end(ev->ap);
+  va_end(ev->ap_copy);
 }
 
 static void _xbt_log_cat_apply_set(xbt_log_category_t category,
index d9a79c8..6ab4522 100644 (file)
@@ -18,7 +18,8 @@ struct xbt_log_appender_s {
 
 struct xbt_log_layout_s {
   void (*do_layout)(xbt_log_layout_t l,
-                   xbt_log_event_t event, const char *fmt);
+                   xbt_log_event_t event, const char *fmt,
+                   xbt_log_appender_t appender);
   void (*free_) (xbt_log_layout_t l);
   void *data;
 } ;
index a6df8ef..5e6bb17 100644 (file)
@@ -9,6 +9,7 @@
 
 #include "portable.h" /* execinfo when available */
 #include "xbt/sysdep.h"
+#include "xbt/strbuff.h"
 #include "xbt/log_private.h"
 #include "gras/virtu.h" /* gras_os_myname (KILLME) */
 #include "xbt/synchro.h" /* xbt_thread_self_name */
 
 extern const char *xbt_log_priority_names[7];
 
-/* Get serious about checking buffer overflows during log construction */
+static double begin_of_time = -1;
+
+#define append1(fmt,fmt2,elm)                                         \
+   do {                                                               \
+       if (precision == -1) {                                        \
+          xbt_strbuff_append(buff, tmp=bprintf(fmt,elm));            \
+          free(tmp);                                                 \
+        } else {                                                      \
+          xbt_strbuff_append(buff, tmp=bprintf(fmt2,precision,elm)); \
+          free(tmp);                                                 \
+          precision = -1;                                            \
+       }                                                             \
+   } while (0)
+#define append2(fmt,elm,elm2)                                         \
+   do {                                                               \
+       xbt_strbuff_append(buff, tmp=bprintf(fmt,elm,elm2));          \
+       free(tmp);                                                    \
+       precision = -1;                                               \
+   } while (0)
+
+static void xbt_log_layout_format_dynamic(xbt_log_layout_t l,
+                                         xbt_log_event_t ev,
+                                         const char*fmt,
+                                         xbt_log_appender_t app) {
+  xbt_strbuff_t buff = xbt_strbuff_new();   
+  int precision=-1;
+  char *q = l->data;
+  char *tmp;
+  char *tmp2;
+
+  while (*q != '\0') {
+    if (*q == '%') {
+      q++;
+       handle_modifier:
+      switch (*q) {
+      case '\0':
+       fprintf(stderr,"Layout format (%s) ending with %%\n",(char*)l->data);
+       abort();
+      case '%':
+       xbt_strbuff_append(buff,"%");
+       break;
+      case 'n': /* platform-dependant line separator (LOG4J compliant) */
+       xbt_strbuff_append(buff,"\n");
+       break;
+      case 'e': /* plain space (SimGrid extension) */
+       xbt_strbuff_append(buff," ");
+       break;
+        
+      case '.': /* precision specifyier */
+       q++;
+       q += sscanf(q,"%d",&precision);
+       goto handle_modifier;
+
+      case 'c': /* category name; LOG4J compliant
+                  should accept a precision postfix to show the hierarchy */
+       append1("%s","%.*s",ev->cat->name);
+       break;
+      case 'p': /* priority name; LOG4J compliant */   
+       append1("%s","%.*s",xbt_log_priority_names[ev->priority]);
+       break;
+
+      case 'h': /* host name; SimGrid extension */
+       append1("%s","%.*s",gras_os_myname());
+       break;
+      case 't': /* thread name; LOG4J compliant */
+       append1("%s","%.*s",xbt_thread_self_name());
+       break;
+      case 'P': /* process name; SimGrid extension */
+       append1("%s","%.*s",xbt_procname());
+       break;
+      case 'i': /* process PID name; SimGrid extension */
+       append1("%d","%.*d",(*xbt_getpid)());
+       break;
+   
+      case 'F': /* file name; LOG4J compliant */
+       append1("%s","%.*s",ev->fileName);
+       break;
+      case 'l': /* location; LOG4J compliant */
+       append2("%s:%d",ev->fileName,ev->lineNum);
+       precision = -1; /* Ignored */
+       break;
+      case 'L': /* line number; LOG4J compliant */
+       append1("%d","%.*d",ev->lineNum);
+       break;
+      case 'M': /* method (ie, function) name; LOG4J compliant */
+       append1("%s","%.*s",ev->functionName);
+       break;
+      case 'b': /* backtrace; called %throwable in LOG4J */
+      case 'B': /* short backtrace; called %throwable{short} in LOG4J */
+#if defined(HAVE_EXECINFO_H) && defined(HAVE_POPEN) && defined(ADDR2LINE)
+       {
+         xbt_ex_t e;
+         int i;
+         
+         e.used     = backtrace((void**)e.bt,XBT_BACKTRACE_SIZE);
+         e.bt_strings = NULL;
+         e.msg=NULL;
+         e.remote=0;
+         xbt_backtrace_current(&e);
+         if (*q=='B') {
+            append1("%s","%.*s",e.bt_strings[2]+8);
+         } else {
+           for (i=2; i<e.used; i++)
+             append1("%s\n","%.*s\n",e.bt_strings[i]+8);
+         }
+          
+         xbt_ex_free(e);
+       }
+#else
+       append1("%s","%.*s","(no backtrace on this arch)");
+#endif
+       break;
+
+      case 'd': /* date; LOG4J compliant */
+       append1("%f","%.*f", gras_os_time());
+       break;
+      case 'r': /* application age; LOG4J compliant */
+       append1("%f","%.*f", gras_os_time()-begin_of_time);
+       break;
+       
+      case 'm': /* user-provided message; LOG4J compliant */
+       vasprintf(&tmp2, fmt, ev->ap_copy);
+       append1("%s","%.*s",tmp2);
+       free(tmp2);
+       break;
+
+      default:
+       fprintf(stderr,"Unknown %%%c sequence in layout format (%s)\n",
+               *q,(char*)l->data);
+       abort();
+      }
+      q++;
+    } else {
+      char tmp2[2];
+      tmp2[0] = *(q++);
+      tmp2[1] = '\0';
+      xbt_strbuff_append(buff,tmp2);
+    }
+  }
+  app->do_append(app,buff->data);
+  xbt_strbuff_free(buff);
+}
+
 #define check_overflow \
   if (p-ev->buffer > XBT_LOG_BUFF_SIZE) { /* buffer overflow */ \
-     p=ev->buffer + XBT_LOG_BUFF_SIZE - strlen(" >> OUTPUT TRUNCATED <<\n"); \
-     p+=sprintf(p," >> OUTPUT TRUNCATED <<\n");  \
+     xbt_log_layout_format_dynamic(l,ev,msg_fmt,app); \
      return;\
   } 
-
 static void xbt_log_layout_format_doit(xbt_log_layout_t l,
                                       xbt_log_event_t ev, 
-                                      const char *msg_fmt) {
-  static double begin_of_time = -1;
+                                      const char *msg_fmt,
+                                      xbt_log_appender_t app) {
   char *p,*q;
   int precision=-1;
 
@@ -249,6 +390,7 @@ static void xbt_log_layout_format_doit(xbt_log_layout_t l,
     }
   }
   *p = '\0';
+  app->do_append(app,ev->buffer);
 }
 
 static void xbt_log_layout_format_free(xbt_log_layout_t lay) {
index 482e5d1..0ae8480 100644 (file)
@@ -8,25 +8,61 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "xbt/sysdep.h"
+#include "xbt/strbuff.h" /* For dynamic version when the static one fails */
 #include "xbt/log_private.h"
 #include "xbt/synchro.h" /* xbt_thread_name */
+
 #include "gras/virtu.h"
 #include <stdio.h>
 #include "portable.h"
 
 extern const char *xbt_log_priority_names[7];
 
+static double begin_of_time = -1;
+
+static void xbt_log_layout_simple_dynamic(xbt_log_layout_t l,
+                                         xbt_log_event_t ev,
+                                         const char*fmt,
+                                         xbt_log_appender_t app) {
+   xbt_strbuff_t buff = xbt_strbuff_new();
+   char *p;
+   
+   /* Put every static information in the static buffer, and copy them in the dyn one */
+   p = ev->buffer;
+   p += snprintf(p,XBT_LOG_BUFF_SIZE-(p-ev->buffer),"[");
+
+   if(strlen(xbt_procname()))
+     p += snprintf(p,XBT_LOG_BUFF_SIZE-(p-ev->buffer),"%s:%s:(%d) ", 
+                  gras_os_myname(), xbt_procname(),(*xbt_getpid)());
+   p += snprintf(p,XBT_LOG_BUFF_SIZE-(p-ev->buffer),"%f] ", gras_os_time()-begin_of_time);
+   if (ev->priority != xbt_log_priority_info)
+     p += snprintf(p,XBT_LOG_BUFF_SIZE-(p-ev->buffer), "%s:%d: ", ev->fileName, ev->lineNum);
+   p += snprintf(p,XBT_LOG_BUFF_SIZE-(p-ev->buffer), "[%s/%s] ", 
+                ev->cat->name, xbt_log_priority_names[ev->priority] );
+   
+   xbt_strbuff_append(buff,ev->buffer);
+
+   vasprintf(&p,fmt,ev->ap);
+   xbt_strbuff_append(buff,p);
+   free(p);
+
+   xbt_strbuff_append(buff,"\n");
+
+   app->do_append(app,buff->data);
+   xbt_strbuff_free(buff);
+}
+
 /* only used after the format using: we suppose that the buffer is big enough to display our data */
 #define check_overflow \
   if (p-ev->buffer > XBT_LOG_BUFF_SIZE) { /* buffer overflow */ \
-     p=ev->buffer + XBT_LOG_BUFF_SIZE - strlen(" >> OUTPUT TRUNCATED <<\n"); \
-     p+=sprintf(p," >> OUTPUT TRUNCATED <<\n"); \
+     xbt_log_layout_simple_dynamic(l,ev,fmt,app); \
+     return; \
   } 
 
 static void xbt_log_layout_simple_doit(xbt_log_layout_t l,
                                       xbt_log_event_t ev, 
-                                      const char *fmt) {
-  static double begin_of_time = -1;
+                                      const char *fmt,
+                                      xbt_log_appender_t app) {
   char *p;  
 
   xbt_assert0(ev->priority>=0,
@@ -64,6 +100,7 @@ static void xbt_log_layout_simple_doit(xbt_log_layout_t l,
   /* End it */
   p += snprintf(p,XBT_LOG_BUFF_SIZE-(p-ev->buffer), "\n");
   check_overflow;
+  app->do_append(app,ev->buffer);
 }
 
 xbt_log_layout_t xbt_log_layout_simple_new(char *arg) {
index 99916b8..1d2b34b 100644 (file)
@@ -25,6 +25,13 @@ LDADD_RL=$(abs_top_builddir)/src/libgras.la
 ### XBT tests ###
 #################
 
+  ## Try large logs ##
+  ####################
+
+TESTS += xbt/log_large_test.tesh
+noinst_PROGRAMS += xbt/log_large_test
+xbt_log_large_test_LDADD = $(LDADD_SG)
+
   ## Try parallel logs ##
   #######################
 
index 91dc275..3896ac0 100644 (file)
@@ -44,7 +44,8 @@ POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-noinst_PROGRAMS = xbt/parallel_log_crashtest$(EXEEXT) \
+noinst_PROGRAMS = xbt/log_large_test$(EXEEXT) \
+       xbt/parallel_log_crashtest$(EXEEXT) \
        gras/datadesc/datadesc_usage$(EXEEXT) \
        gras/msg_handle/msg_handle_client$(EXEEXT) \
        gras/msg_handle/msg_handle_server$(EXEEXT) \
@@ -169,6 +170,9 @@ am_simdag_partask_test_comp_only_seq_OBJECTS =  \
 simdag_partask_test_comp_only_seq_OBJECTS =  \
        $(am_simdag_partask_test_comp_only_seq_OBJECTS)
 simdag_partask_test_comp_only_seq_DEPENDENCIES = $(LDADD_SG)
+xbt_log_large_test_SOURCES = xbt/log_large_test.c
+xbt_log_large_test_OBJECTS = log_large_test.$(OBJEXT)
+xbt_log_large_test_DEPENDENCIES = $(LDADD_SG)
 xbt_parallel_log_crashtest_SOURCES = xbt/parallel_log_crashtest.c
 xbt_parallel_log_crashtest_OBJECTS = parallel_log_crashtest.$(OBJEXT)
 xbt_parallel_log_crashtest_DEPENDENCIES = $(LDADD_RL)
@@ -201,7 +205,7 @@ SOURCES = $(gras_datadesc_datadesc_usage_SOURCES) \
        $(simdag_network_test_reinit_costs_SOURCES) \
        $(simdag_partask_test_comp_only_par_SOURCES) \
        $(simdag_partask_test_comp_only_seq_SOURCES) \
-       xbt/parallel_log_crashtest.c
+       xbt/log_large_test.c xbt/parallel_log_crashtest.c
 DIST_SOURCES = $(gras_datadesc_datadesc_usage_SOURCES) \
        $(gras_msg_handle_msg_handle_client_SOURCES) \
        $(gras_msg_handle_msg_handle_server_SOURCES) \
@@ -219,7 +223,7 @@ DIST_SOURCES = $(gras_datadesc_datadesc_usage_SOURCES) \
        $(simdag_network_test_reinit_costs_SOURCES) \
        $(simdag_partask_test_comp_only_par_SOURCES) \
        $(simdag_partask_test_comp_only_seq_SOURCES) \
-       xbt/parallel_log_crashtest.c
+       xbt/log_large_test.c xbt/parallel_log_crashtest.c
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -379,7 +383,7 @@ EXTRA_DIST = gras/datadesc/datadesc.little32_4 \
        simdag/partask/platform_2p_1sl_hetero.xml \
        simdag/partask/platform_2p_1sl.xml
 TESTS_ENVIRONMENT = $(top_builddir)/tools/tesh/tesh
-TESTS = xbt/parallel_log_crashtest.tesh \
+TESTS = xbt/log_large_test.tesh xbt/parallel_log_crashtest.tesh \
        gras/datadesc/datadesc_mem.tesh gras/datadesc/datadesc_rw.tesh \
        gras/datadesc/datadesc_r_little32_4.tesh \
        gras/datadesc/datadesc_r_little64.tesh \
@@ -405,6 +409,7 @@ XFAIL_TESTS = gras/datadesc/datadesc_r_little32.tesh \
        gras/datadesc/datadesc_r_big32_2.tesh
 LDADD_SG = $(abs_top_builddir)/src/libsimgrid.la
 LDADD_RL = $(abs_top_builddir)/src/libgras.la
+xbt_log_large_test_LDADD = $(LDADD_SG)
 xbt_parallel_log_crashtest_LDADD = $(LDADD_RL)
 gras_datadesc_datadesc_usage_SOURCES = gras/datadesc/datadesc_usage.c gras/datadesc/datadesc_structs.c
 gras_datadesc_datadesc_usage_LDADD = $(LDADD_RL)
@@ -570,6 +575,9 @@ simdag/partask/test_comp_only_seq$(EXEEXT): $(simdag_partask_test_comp_only_seq_
 xbt/$(am__dirstamp):
        @$(MKDIR_P) xbt
        @: > xbt/$(am__dirstamp)
+xbt/log_large_test$(EXEEXT): $(xbt_log_large_test_OBJECTS) $(xbt_log_large_test_DEPENDENCIES) xbt/$(am__dirstamp)
+       @rm -f xbt/log_large_test$(EXEEXT)
+       $(LINK) $(xbt_log_large_test_OBJECTS) $(xbt_log_large_test_LDADD) $(LIBS)
 xbt/parallel_log_crashtest$(EXEEXT): $(xbt_parallel_log_crashtest_OBJECTS) $(xbt_parallel_log_crashtest_DEPENDENCIES) xbt/$(am__dirstamp)
        @rm -f xbt/parallel_log_crashtest$(EXEEXT)
        $(LINK) $(xbt_parallel_log_crashtest_OBJECTS) $(xbt_parallel_log_crashtest_LDADD) $(LIBS)
@@ -591,6 +599,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basic5.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/datadesc_structs.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/datadesc_usage.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log_large_test.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msg_handle.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parallel_log_crashtest.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_comp_only_par.Po@am__quote@
@@ -933,6 +942,20 @@ test_comp_only_seq.obj: simdag/partask/test_comp_only_seq.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_comp_only_seq.obj `if test -f 'simdag/partask/test_comp_only_seq.c'; then $(CYGPATH_W) 'simdag/partask/test_comp_only_seq.c'; else $(CYGPATH_W) '$(srcdir)/simdag/partask/test_comp_only_seq.c'; fi`
 
+log_large_test.o: xbt/log_large_test.c
+@am__fastdepCC_TRUE@   $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT log_large_test.o -MD -MP -MF $(DEPDIR)/log_large_test.Tpo -c -o log_large_test.o `test -f 'xbt/log_large_test.c' || echo '$(srcdir)/'`xbt/log_large_test.c
+@am__fastdepCC_TRUE@   mv -f $(DEPDIR)/log_large_test.Tpo $(DEPDIR)/log_large_test.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='xbt/log_large_test.c' object='log_large_test.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o log_large_test.o `test -f 'xbt/log_large_test.c' || echo '$(srcdir)/'`xbt/log_large_test.c
+
+log_large_test.obj: xbt/log_large_test.c
+@am__fastdepCC_TRUE@   $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT log_large_test.obj -MD -MP -MF $(DEPDIR)/log_large_test.Tpo -c -o log_large_test.obj `if test -f 'xbt/log_large_test.c'; then $(CYGPATH_W) 'xbt/log_large_test.c'; else $(CYGPATH_W) '$(srcdir)/xbt/log_large_test.c'; fi`
+@am__fastdepCC_TRUE@   mv -f $(DEPDIR)/log_large_test.Tpo $(DEPDIR)/log_large_test.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='xbt/log_large_test.c' object='log_large_test.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o log_large_test.obj `if test -f 'xbt/log_large_test.c'; then $(CYGPATH_W) 'xbt/log_large_test.c'; else $(CYGPATH_W) '$(srcdir)/xbt/log_large_test.c'; fi`
+
 parallel_log_crashtest.o: xbt/parallel_log_crashtest.c
 @am__fastdepCC_TRUE@   $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT parallel_log_crashtest.o -MD -MP -MF $(DEPDIR)/parallel_log_crashtest.Tpo -c -o parallel_log_crashtest.o `test -f 'xbt/parallel_log_crashtest.c' || echo '$(srcdir)/'`xbt/parallel_log_crashtest.c
 @am__fastdepCC_TRUE@   mv -f $(DEPDIR)/parallel_log_crashtest.Tpo $(DEPDIR)/parallel_log_crashtest.Po
@@ -1220,6 +1243,8 @@ uninstall-am:
 
   #######################
 
+  #######################
+
 ##################
 ### GRAS tests ###
 ##################
diff --git a/teshsuite/xbt/log_large_test.c b/teshsuite/xbt/log_large_test.c
new file mode 100644 (file)
index 0000000..0ab8b79
--- /dev/null
@@ -0,0 +1,37 @@
+/* $Id$ */
+
+/* log_large_test -- log a very large string to test the dynamic variants   */
+
+/* Copyright (c) 2007 Martin Quinson. All rights reserved.                  */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include "gras.h"
+#include "xbt/synchro.h"
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(test,"Logs of this example");
+
+
+int main(int argc, char *argv[]){
+  char *tmp=bprintf("\n%d%s%d%s%d%s%d%s%d%s%d%s%d%s%d%s%d%s%d%s",
+                   1,".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
+                   2,".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
+                   3,".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
+                   4,".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
+                   5,".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
+                   6,".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
+                   7,".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
+                   8,".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
+                   9,".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
+                   0,".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n");
+
+  xbt_init(&argc,argv);
+
+  INFO10("This is a very large message:0%s1%s2%s3%s4%s5%s6%s7%s8%s9%s",tmp,tmp,tmp,tmp,tmp,tmp,tmp,tmp,tmp,tmp);
+  INFO1("Done (strlen>%d)",10*strlen(tmp));
+  free(tmp);
+   
+  xbt_exit();
+  return 0;
+}
diff --git a/teshsuite/xbt/log_large_test.tesh b/teshsuite/xbt/log_large_test.tesh
new file mode 100644 (file)
index 0000000..f29e9dc
--- /dev/null
@@ -0,0 +1,229 @@
+
+p Tries whether the dynamic version of the log layouts work
+$ $SG_EXENV_TEST xbt/log_large_test
+> [0.000000] [test/INFO] This is a very large message:0
+> 1.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 2.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 3.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 4.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 5.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 6.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 7.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 8.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 9.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 0.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 1
+> 1.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 2.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 3.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 4.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 5.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 6.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 7.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 8.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 9.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 0.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 2
+> 1.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 2.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 3.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 4.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 5.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 6.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 7.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 8.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 9.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 0.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 3
+> 1.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 2.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 3.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 4.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 5.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 6.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 7.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 8.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 9.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 0.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 4
+> 1.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 2.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 3.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 4.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 5.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 6.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 7.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 8.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 9.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 0.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 5
+> 1.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 2.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 3.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 4.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 5.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 6.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 7.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 8.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 9.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 0.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 6
+> 1.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 2.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 3.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 4.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 5.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 6.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 7.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 8.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 9.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 0.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 7
+> 1.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 2.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 3.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 4.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 5.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 6.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 7.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 8.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 9.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 0.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 8
+> 1.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 2.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 3.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 4.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 5.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 6.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 7.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 8.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 9.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 0.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 9
+> 1.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 2.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 3.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 4.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 5.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 6.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 7.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 8.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 9.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 0.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 
+> [0.000000] [test/INFO] Done (strlen>10210)
+
+$ $SG_EXENV_TEST xbt/log_large_test --log=root.fmt:%m%n 
+> This is a very large message:0
+> 1.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 2.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 3.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 4.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 5.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 6.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 7.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 8.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 9.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 0.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 1
+> 1.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 2.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 3.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 4.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 5.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 6.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 7.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 8.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 9.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 0.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 2
+> 1.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 2.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 3.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 4.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 5.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 6.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 7.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 8.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 9.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 0.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 3
+> 1.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 2.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 3.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 4.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 5.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 6.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 7.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 8.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 9.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 0.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 4
+> 1.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 2.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 3.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 4.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 5.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 6.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 7.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 8.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 9.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 0.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 5
+> 1.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 2.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 3.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 4.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 5.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 6.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 7.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 8.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 9.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 0.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 6
+> 1.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 2.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 3.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 4.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 5.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 6.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 7.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 8.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 9.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 0.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 7
+> 1.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 2.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 3.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 4.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 5.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 6.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 7.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 8.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 9.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 0.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 8
+> 1.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 2.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 3.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 4.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 5.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 6.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 7.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 8.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 9.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 0.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 9
+> 1.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 2.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 3.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 4.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 5.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 6.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 7.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 8.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 9.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 0.........1.........2.........3.........4.........5.........6.........7.........8.........9.........0
+> 
+> Done (strlen>10210)