Skip to Content.
Sympa Menu

freetds - RE: [freetds] Log, patch and format

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] Log, patch and format
  • Date: Fri, 10 Dec 2004 13:20:06 +0100

>
> "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com> wrote:
> > I'm trying to change log format to include source line
> informations (as
> > suggested)
>
> [cool patch snipped]
>
> > It's working fine but log format it's not so fine. Just an
> extract (just
> > 3 lines):
> >
> > 11:20:41.230206 31045 (token.c:320):looking for login token, got
> > e3(ENVCHANGE)
> > 11:20:41.230238 31045
> (token.c:105):tds_process_default_tokens() marker
> > is e3(ENVCHANGE)
> > 11:20:41.230259 31045 (read.c:178):tds_get_string: reading
> 8 from wire
> > to give 4 to client.
> >
> > As anyone can see line it's quite long. The reason it's
> that it contains
> > all possible informations:
> > - time
> > - pid
> > - source file and line
> > - message
> > I know that James don't like that much time at every line
> but it's very
> > useful to discover problems related to speed.
> > Perhaps it would be better to define some flags to
> enable/disable every
> > component (time, pid, source and perhaps thread id where
> pid1 == pid2 do
> > not means thread1 == thread2)
>
> I can see the occasional value in including time, and I know
> even isn't
> useful in most situations.
>
> We have a place for a flag to include/exclude columns: the TDS_DBG_*
> bitmask.
>
> #define TDS_DBG_TIME __FILE__, ((__LINE__ << 4) | 8)
> #define TDS_DBG_PID __FILE__, ((__LINE__ << 4) | 9)
>
> Then reformat accordingly, in tds_dump().
>
> I think time and pid should be disabled in the default mask (currently
> '99'), because problems posted to the list normally don't
> need them. If
> someone needs it, we can say "set your log mask to 0xf8" or
> whatever.
>
> Nice work, Freddy. Thanks for tackling it.
>

Mmm... so I don't understant these lines

#define TDS_DBG_TIME __FILE__, ((__LINE__ << 4) | 8)
#define TDS_DBG_PID __FILE__, ((__LINE__ << 4) | 9)

As you see I packed line and level. Usually TDS_DBG_* constants are used
to declare the type (currently and from patch the level) of debugging.
In this case log mask would filter only some information types (like
time and pid), not on level.
I think the confusion raise from our constants

TDS_DBG_FUNC
TDS_DBG_INFO2
TDS_DBG_INFO1
TDS_DBG_NETWORK
TDS_DBG_WARN
TDS_DBG_ERROR
TDS_DBG_SEVERE

As you can see FUNC and NETWORK suggest a type of log while others
suggest a level. I think that looking at priority SEVERE > ERROR > WARN
> INFO2 > INFO1 but I don't know where to put NETWORK and FUNC...
Perhaps a mask that can filter any type/level of log and informations
types would be better. For example:
0x01 FUNC
0x02 INFO1
0x04 INFO2
0x08 NETWORK
0x10 WARN
0x20 ERROR
0x40 SEVER
0x10000 PID
0x20000 TIME
0x40000 SOURCE
0x80000 THREAD ??

(default 0x4ffff)

freddy77





Archive powered by MHonArc 2.6.24.

Top of Page