[Xorp-hackers] Compilation with --enable-debug-msgs AND --enable-debug-fnames is broken

Orion Hodson orion@icir.org
Thu, 15 Apr 2004 08:58:27 -0700


On Apr 15, 2004, at 06:27, Paolo Pisati wrote:

>
> [root@ubi8 xorp]# uname -a
> FreeBSD xxxxxxxxxxxx 4.10-BETA FreeBSD 4.10-BETA #2: Tue Apr 13 
> 17:01:22 CEST 2004     flag@xxxxxxxxxxxxx:/usr/obj/usr/src/sys/UBI  
> i386
> [root@ubi8 xorp]# gcc -v
> Using builtin specs.
> gcc version 2.95.4 20020320 [FreeBSD]
> [root@ubi8 xorp]#
>
> I was in search for a method to enable the logs, when i decided to 
> recompile XORP
> with --enable-debug-msgs and --enable-debug-fnames, but the compilation
> process stopped almost immediately.

Okay, the first failure, in libxorp, is fixed and committed.  There are 
more fixes to follow shortly for bgp.

> Anyway, the first question still holds, how can i enable any kind of
> logging? And where are placed?

There are two forms of logging - XORP process logging and debug logging.

The process logging is for event notifications, akin to syslog.  The 
relevant code methods are declared in libxorp/xlog.h.  There's 
documentation in the libxorp overview:

	http://www.xorp.org/releases/current/docs/libxorp/libxorp_overview.pdf

Most programs and tests show the relevant preamble and usage.

Debug logging is for any events that want logging during development.  
There's a debug_msg macro that takes a format string followed by a set 
of variadic arguments, like printf.  Debug messages can be enabled 
globally via --enable-debug-msgs, or on a per-file basis by defining 
DEBUG_LOGGING before including libxorp/debug.h.  Globally enabling 
debug_msg is probably not very useful.

> I recompiled XORP with just --enable-debug-msgs but the output was 
> completely
> messed up and almost useless...

The format of the debug output is:

[ <pid> +<lineno> <file> ] <message>

<pid> is the process identifier and is included for disambiguating 
messages when multiple processes are generating output.

The format of the line number and file is such that it can cut and 
paste as an argument to a Unix editor (e.g. emacs, vi) and take the 
user to the source of the message.

Hopefully this helps understand the mess.

Cheers
	Orion