From: Alex M. <ale...@cl...> - 2003-10-30 08:54:16
|
On Wed, Oct 29, 2003 at 11:07:26PM -0800, Kevin Goess wrote: > | I see that MDC.pm has an undef value (which was recently '[undef]') > | but I don't see where it's changed to an empty string. By subclassing the > | place where undef values are changed to empty string, I could certainly > | get rid of my problem. > > It's changed in the sprintf() in PatternLayout::render(), since this: > > sprintf("%s", undef) > > produces the empty string, not undef. Thanks I'll have a look at it. I'll inform you of my research :) > | That's why it would be nice to provide a way for the users to do some > | kind of preprocessing on MDC values in order to handle problems which > | are specific to some kind of appenders. > > Tell me if I'm just being dense (which is more than likely), but is it > not true that you *do* have complete control the MDC values, you can > init the troublesome one via MDC->put('somenumeric',0) right next to > where you call Log4perl::init(), or even in a BEGIN{} block somewhere. > Right? Let me explain a bit the context. My application sends email. But it also does other things (like providing the user a web interface). I have a table where I insert informations about sent mail. When there is a problem while sending a mail, I log it in a file, but also in an error table, and I put in the error table the id of the failed mail. So, the integer column in the error table references primary keys of the sent mail table. As I said, error could happen when doing something else than sending a mail, so the integer column of my error table can hold NULL values. If I put a default value (0 for example) it could work if : - I remove the referecing integrity constraint or - I create a fake sent-mail which have an id of 0 and put if clauses everywhere in my code in order to not display information about this fake sent-mail Both of these solutions could work as quick workaround, but it's not clean. |