[Serusers] some tunning to syslog messages

Ricardo Carvalho rcarvalho at iric.up.pt
Fri Oct 27 13:33:34 CEST 2006


Sorry, the code I posted in last message isn't right. This is the right one:

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include <syslog.h>
#include <stdio.h>

int main(int argc,char ** argv){
           char *message = "This is a message \n  and this is the rest";
           int priority = LOG_INFO | LOG_LOCAL6;

          syslog(priority,message);

 return 0;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////

Regards,
Ricardo.





Ricardo Carvalho wrote:
> Hi all,
>
> Along my ser.cfg code I want to print a formatted message using LOG 
> functions like xlog implemented with xlog module of Ser. I already can 
> do it, but now I pretend to write in the same xlog formatted message, 
> some formatted text that can be splitted in multiple lines. I thought 
> that it could be done using \n sintax, like in C, but some testing 
> made me realise that it doesn't work. I also found that this isn't a 
> problem of xlog module of Ser, but a limitation of Syslog service 
> because doing a simple program like this won't result like expected:
>
> ////////////////////////////////////////////////////////////////////////////////////////////////////////////// 
>
> #include <syslog.h>
> #include <stdio.h>
>
> int main(int argc,char ** argv){
>           char *message = "This is a messagea  and this is the rest";
>           int priority = LOG_INFO | LOG_LOCAL6;
>
>          syslog(priority,"This is a message %c and this is the rest",13);
>
> return 0;
> }
> ////////////////////////////////////////////////////////////////////////////////////////////////////////////// 
>
>
> The output of this program results in the same line of syslog dump.
>
> In ser.cfg if I do something like the following line, the resulting 
> print to syslog is still written in one line:
>
> xlog("L_INFO", "===> received [%rm] request\n From URI: [%fu]\n");
>
> Syslog simply ignores the \n parameter.
> Is there any other way to split xlog formatted messages of ser.cfg to 
> be written to Syslog?
>
> Thanks in advance,
> Ricardo.
> _______________________________________________
> Serusers mailing list
> Serusers at lists.iptel.org
> http://lists.iptel.org/mailman/listinfo/serusers
>




More information about the sr-users mailing list