RE: glib's g_logv 1024 byte maximum character array



> > Should I be limiting all my arguments to 1024 bytes? or should this be
an
> > improvement in Glib?
> 
> I'm quite sure this limit is inherited from the syslog protocol (which
will be used to transfer the log messages in many cases). > The
specification of the syslog protocol says that both the header and the
message together must be at most 1024 bytes (see RFC > > 3164 section 4.1).

Does printf have the same limitations?  I am going to test this myself later
tonight.

> My recomendation is to keep log messages very brief (about one line of
text) and maybe log additional information separately with > debug severity.

Debug severity? Do you mean like:
	g_log(domain, G_LOG_LEVEL_DEBUG, "%s", message);   

If so how would that differ from and other type of log level? If not how
would I do it? fprintf/printf?

Most the logging is brief.  But if I receive a stream of data from a TCP
socket which is 2048 bytes long, I then have a string which is too long to
use with g_log().  I need to know what comes in from the socket, it is not
acceptable to just ignore that information.

Can GLib not be improved to handle arguments similar to
fprintf/printf/etc...?  I just wrote a simple application which filled a
string with 4096 x characters and then did printf("%s", buffer) and it
worked fine.  Surely Glibs implementation should be as good as printf at
least.


Regards,
Martyn




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]