Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Oct 2005 21:09:55 -0600 (MDT)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        bharmaji@gmail.com
Cc:        freebsd-drivers@freebsd.org
Subject:   Re: Recommended ways to log driver operations
Message-ID:  <20051017.210955.104032631.imp@bsdimp.com>
In-Reply-To: <67beabb0510171825q1e124bf6v2adbe0c9f235a6ae@mail.gmail.com>
References:  <67beabb0510171825q1e124bf6v2adbe0c9f235a6ae@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In message: <67beabb0510171825q1e124bf6v2adbe0c9f235a6ae@mail.gmail.com>
            Bharma Ji <bharmaji@gmail.com> writes:
: I recently wrote a driver for a chip. I am wondering if there are any
: standard recommended ways of logging the driver operations. I have used
: printf in the driver and I look at it using dmesg so far. Am wondering if it
: is possible to create a driver specific log file so that it is easy to
: debug. Also, if the driver emits copious output then the log buffer will
: overflow and some messages may be truncated. Writing to a specific log file
: may help in that case. However, I have no idea if this is worth
: investigating. Any suggestions appreciated

printf(9) doesn't give you much of a chance to segregate the logs.  You
can also use log(9), but that just adds the ability to give a priority
to the log message, which can help.

If you want to debug the driver to find out what's going on at a high
rate, you might want to look at ktr(9) and alq(9).  These facilities
are more for debugging and performance tuning, rather than day to day
operations.  In general, FreeBSD drivers follow the unix tradition of
only complaining when there are problems.

Warner



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051017.210955.104032631.imp>