You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4php-dev@logging.apache.org by "Patrick H. Piper" <pp...@netlinxinc.com> on 2006/02/23 15:00:30 UTC

is LoggerAppenderAdodb functional?

I have attempted to use this appender, but can't seem to make it work.  Does
anyone know the status of this contributed component?  I know that I was
making connections to the database, however, the SQL was getting written to
the database.

Any help and/or suggestions are welcome.

I didn't notice any test files for this particular appender.

patrick


RE: is LoggerAppenderAdodb functional?

Posted by "Patrick H. Piper" <pp...@netlinxinc.com>.
Yes, I have traditionally used LoggerAppenderDb, but since I use Adodb for
everything else, I was hoping to consolidate connections and usage of just
one Database abstraction layer.

While on the topic of LoggerAppenderDb, I use a pattern of:

Log4php.appender.DB.sql="INSERT INTO log VALUES (0,'%F','%d{Y-m-d
H:i:s}','%p','%m')"

On UNIX %F shows in the database the full path to the phpfile/class:

i.e. /my/full/path/to/file.php

whereas on WIN32, %F is written to the database:

i.e. C:myfullpathtofile.php 

I realize that "\" is not getting escaped, so my question is:

What can I do to make %F portable? Is there something that I can do to the
SQL in the properties file? Do I have to change my magic_quotes_gpc setting?
Is this a bug? Sort of stumped.

Thanks for your help.

PS I loved the article.  It was very timely for me as I am starting to make
much greater use of this log4php library/class.


-----Original Message-----
From: Knut Urdalen [mailto:knut.urdalen@telio.no] 
Sent: Thursday, February 23, 2006 9:18 AM
To: Log4PHP Dev
Subject: Re: is LoggerAppenderAdodb functional?

Patrick H. Piper wrote:

>I have attempted to use this appender, but can't seem to make it work.
Does
>anyone know the status of this contributed component?  I know that I was
>making connections to the database, however, the SQL was getting written to
>the database.
>
>Any help and/or suggestions are welcome.
>
>I didn't notice any test files for this particular appender.
>  
>
I don't know this appender, I've only used LoggerAppenderDb for logging 
to database which can be used this way:

<appender name="test" class="LoggerAppenderDb">
  <param name="dsn" value="mysql://localhost/test" />
  <param name="createTable" value="true" />
  <param name="table" value="log4php" />
  <param name="sql" value="INSERT INTO log4php (timestamp, logger, 
level, message, thread, file, line) VALUES 
('%d','%c','%p','%m','%t','%F','%L')" />
</appender>

But I suppose you know that already :)

Remember that you can also use MDC to map additional data:

  LoggerMDC::put('key', 'value');

And map that to a field in the database with:

  %X{key}

Typically used for user name and remote address etc.

Regards,
Knut Urdalen


Re: is LoggerAppenderAdodb functional?

Posted by Knut Urdalen <kn...@telio.no>.
Patrick H. Piper wrote:

>I have attempted to use this appender, but can't seem to make it work.  Does
>anyone know the status of this contributed component?  I know that I was
>making connections to the database, however, the SQL was getting written to
>the database.
>
>Any help and/or suggestions are welcome.
>
>I didn't notice any test files for this particular appender.
>  
>
I don't know this appender, I've only used LoggerAppenderDb for logging 
to database which can be used this way:

<appender name="test" class="LoggerAppenderDb">
  <param name="dsn" value="mysql://localhost/test" />
  <param name="createTable" value="true" />
  <param name="table" value="log4php" />
  <param name="sql" value="INSERT INTO log4php (timestamp, logger, 
level, message, thread, file, line) VALUES 
('%d','%c','%p','%m','%t','%F','%L')" />
</appender>

But I suppose you know that already :)

Remember that you can also use MDC to map additional data:

  LoggerMDC::put('key', 'value');

And map that to a field in the database with:

  %X{key}

Typically used for user name and remote address etc.

Regards,
Knut Urdalen