DBI -> trace

DBI -> trace

am 31.07.2006 22:41:06 von Rob Thomp

Hi!
I'm using the DBI module for perl. I want to use DBI->trace{2, 'filename')
for tracing database information. I'm forking new processes, and on each
process
I make connection to the database. I write logging infos from each thread to
1.log, 2.log.. etc
My problem is, that I want to add the dbi tracing information to each
thread's logfile, but dbi->trace
generates only a big file in which it concatenates each process' tracing
info..
is there any solution to this? I read the CPAN manual, see the DBI.pm source
code, but can't figure out.
I can't install new modules to the system where perl is running
thank you guys!
rob

Re: DBI -> trace

am 31.07.2006 23:10:45 von Paul Lalli

Rob Thomp wrote:
> I'm using the DBI module for perl. I want to use DBI->trace{2, 'filename')

Syntax error. Please copy and paste your code. Do not retype.

> for tracing database information. I'm forking new processes, and on each
> process
> I make connection to the database. I write logging infos from each thread

Each thread? I thought you said you were forking.
Do you have threads or do you have processes?

> to 1.log, 2.log.. etc
> My problem is, that I want to add the dbi tracing information to each
> thread's logfile, but dbi->trace
> generates only a big file in which it concatenates each process' tracing
> info..
> is there any solution to this?

Why not just call DBI->trace in each process *after* the fork has
happened, and generate the filename using the PID of each process?

Paul Lalli

Re: DBI -> trace

am 03.08.2006 19:23:57 von Rob Thomp

Sorry. I know the difference between a child process and thread, but usually
I call each of
them "threads".
I've solved it at last. when I start the child processes for each of them I
assign a DBI
tracing with different filenames, as you suggested, thank you!
rob


"Paul Lalli" az alábbiakat írta a következo hírüzenetben:
1154378664.643121.187700@b28g2000cwb.googlegroups.com...
> Rob Thomp wrote:
>> I'm using the DBI module for perl. I want to use DBI->trace{2,
>> 'filename')
>
> Syntax error. Please copy and paste your code. Do not retype.
>
>> for tracing database information. I'm forking new processes, and on each
>> process
>> I make connection to the database. I write logging infos from each thread
>
> Each thread? I thought you said you were forking.
> Do you have threads or do you have processes?
>
>> to 1.log, 2.log.. etc
>> My problem is, that I want to add the dbi tracing information to each
>> thread's logfile, but dbi->trace
>> generates only a big file in which it concatenates each process' tracing
>> info..
>> is there any solution to this?
>
> Why not just call DBI->trace in each process *after* the fork has
> happened, and generate the filename using the PID of each process?
>
> Paul Lalli
>