From: Kevin G. <ke...@go...> - 2003-01-20 17:40:34
|
The new stuff is checked in, all tests pass. -- Happy Trails . . . Kevin M. Goess (and Anne and Frank) 904 Carmel Ave. Albany, CA 94706 (510) 525-5217 |
From: <msc...@ao...> - 2003-01-21 07:53:36
|
In a message dated 1/20/2003 12:40:27 PM Eastern Standard Time, Kevin Goess <ke...@go...> writes: >The new stuff is checked in, all tests pass. That's great news, thanks! Couple of notes: * in the DBI appender's docs, the sentence "You can mix up the order the placeholders with %x specifiers as you see fit" seems to be missing an "of" and I'm confused about what the %x specifier does in this context. * What happens in case PatternLayout is chosen instead of NoopLayout? Probably needs to be documented. * Also, I thought that filter_message would be a code ref which could be used to manipulate logger arguments? I think the appender should be able to correct any log statement argument list (like limit it to the number of arguments it expects etc.) * could you please add some comments to the "Changes" file (also about the XML-DOM addition) * I've corrected Ceki's name in the DOMConfiguration docs with umlauts, these crazy Europeans are so adamant about it :) Also, is there a URL to the original spec we could add? BTW, I'm gonna add a couple of test cases for the new { filter => \&filter, value => $value} syntax. All test cases run fine on my box, too, looks good so far! -- Mike ############################ # Mike Schilli # # log...@pe... # # http://perlmeister.com # # log4perl.sourceforge.net # ############################ |
From: Kevin G. <ke...@go...> - 2003-01-21 17:16:20
|
> * Also, I thought that filter_message would be a code ref which could > be used to manipulate logger arguments? I think the appender should > be able to correct any log statement argument list (like limit it to > the number of arguments it expects etc.) Yes, it is, see Appender.pm line 135: #filter_message is defined and true }else{ $p->{message} = $self->{filter_message}->($p->{message}); #syntax ok for perl5? } But it still needs testing, documentation, and accessor methods in appender. I can do them unless you get around to it first. > * could you please add some comments to the "Changes" file (also > about the XML-DOM addition) Done, thanks for reminding me. Did I forget anything? * (kg) Split config bits into PropertyConfigurator and implemented DOMConfigurator for XML configs. * (kg) Adding appender.filter_message parameter as a help to DBI appender * (kg) Added NoopLayout to help DBI appender > * I've corrected Ceki's name in the DOMConfiguration docs with > umlauts, these crazy Europeans are so adamant about it :) I was wondering how to approach those. I'm don't think using character 0xFC for u-with-diaeresis will translate into systems using other non-ISO8859 character sets (like DOS using CP437 or Macs using MacRoman). But I didn't feel like rebooting into Windows just to check the file in EDIT, so that's cool. > Also, is there a URL to the original spec we could add? Not really, their only "spec" is the log4j DTD and I didn't want to write a link to that since it's buried in their site and could very well move around. When I finish implementing our additions, I'm going to circulate a log4perl DTD for comments and then include it in our distribution. But I did add a note to see t/038XML-DOM1.t for examples. > * in the DBI appender's docs, the sentence "You can mix up the order > the placeholders with %x specifiers as you see fit" seems to be > missing an "of" and I'm confused about what the %x specifier does in > this context. > * What happens in case PatternLayout is chosen instead of NoopLayout? > Probably needs to be documented. Oh, boy, that documentation was truly awful. Thanks for the proofread. I expanded/rewrote that section, it's checked in and listed below for your convenience. Any better? Any criticism welcome! ---------------------------------------------------------------- Normally a list of things in the logging statement gets concatenated into a single string, but setting C<filter_message> to 0 and using the NoopLayout means that in $logger->warn( 1234, 'warning message', 'bgates' ); the individual list values will still be available for the DBI appender later on. (If C<filter_message> is not set to 0, the default behavior is to join the list elements into a single string. If PatternLayout or SimpleLayout are used, their attempt to C<render()> your layout will result in something like "ARRAY(0x841d8dc)" in your logs. More information on C<filter_message> is in Log::Log4perl::Appender.) In your insert SQL you can mix up '?' placeholders with conversion specifiers (%c, %p, etc) as you see fit--the logger will match the question marks to params you've defined in the config file and populate the rest with values from your list. If there are more '?' placeholders than there are values in your message, it will use undef for the rest. For instance, log4j.appender.DBAppndr.sql = \ insert into log4perltest \ (loglevel, message, datestr, subpoena_id)\ values (?,?,?,?) log4j.appender.DBAppndr.params.1 = %p log4j.appender.DBAppndr.params.3 = %d log4j.appender.DBAppndr.filter_message=0 $logger->info('arrest him!', $subpoena_id); results in the first '?' placholder being bound to %p, the second to "arrest him!", the third to the date from "%d", and the fourth to your $subpoena_id. If you forget the $subpoena_id and just log $logger->info('arrest him!'); then you just get undef in the fourth column. msc...@ao... wrote: > In a message dated 1/20/2003 12:40:27 PM Eastern Standard Time, Kevin > Goess <ke...@go...> writes: > > >> The new stuff is checked in, all tests pass. > > > That's great news, thanks! Couple of notes: > > * in the DBI appender's docs, the sentence "You can mix up the order > the placeholders with %x specifiers as you see fit" seems to be > missing an "of" and I'm confused about what the %x specifier does in > this context. > > * What happens in case PatternLayout is chosen instead of NoopLayout? > Probably needs to be documented. > > * Also, I thought that filter_message would be a code ref which could > be used to manipulate logger arguments? I think the appender should > be able to correct any log statement argument list (like limit it to > the number of arguments it expects etc.) > > * could you please add some comments to the "Changes" file (also > about the XML-DOM addition) > > * I've corrected Ceki's name in the DOMConfiguration docs with > umlauts, these crazy Europeans are so adamant about it :) Also, is > there a URL to the original spec we could add? > > BTW, I'm gonna add a couple of test cases for the new { filter => > \&filter, value => $value} syntax. > > All test cases run fine on my box, too, looks good so far! > > -- Mike > > ############################ # Mike Schilli # # > log...@pe... # # http://perlmeister.com # # > log4perl.sourceforge.net # ############################ > -- Happy Trails . . . Kevin M. Goess (and Anne and Frank) 904 Carmel Ave. Albany, CA 94706 (510) 525-5217 |
From: Mike S. <msc...@ao...> - 2003-01-22 03:35:22
|
ke...@go... wrote: > > * Also, I thought that filter_message would be a code ref which could > > be used to manipulate logger arguments? I think the appender should > > be able to correct any log statement argument list (like limit it to > > the number of arguments it expects etc.) > > Yes, it is, see Appender.pm line 135: > > #filter_message is defined and true > }else{ > $p->{message} = > $self->{filter_message}->($p->{message}); #syntax ok for > perl5? > } Just inspected your changes to the docs, now it's much clearer! One piece is left over, though: Somewhere in a log4j conf file sample you say log4j.appender.DBAppndr.filter_message = 1 but that should be a code ref, right? > > > But it still needs testing, documentation, and accessor methods in > appender. I can do them unless you get around to it first. I'll have a closer look tonight ... > > * could you please add some comments to the "Changes" file (also > > about the XML-DOM addition) > > Done, thanks for reminding me. Did I forget anything? Looks good! > > * I've corrected Ceki's name in the DOMConfiguration docs with > > umlauts, these crazy Europeans are so adamant about it :) > > I was wondering how to approach those. I'm don't think using character > 0xFC for u-with-diaeresis will translate into systems using other > non-ISO8859 character sets (like DOS using CP437 or Macs using > MacRoman). But I didn't feel like rebooting into Windows just to > check the file in EDIT, so that's cool. I've eliminated "DOS" and "Mac" from my dictionary :). Not having umlauts on the US keyboard is tough, I'm facing the problem when I write in German. For now, I'm using the notation a^ o^ u^ A^ O^ U^ s^ for Umlauts and a Perl conversion script like #!/usr/bin/perl -n -i -w s/a\^/\344/g; s/o\^/\366/g; s/u\^/\374/g; s/A\^/\304/g; s/O\^/\326/g; s/U\^/\334/g; s/s\^/\337/g; print $_; which I run on the edited file afterwards. Works pretty good! > > > > Also, is there a URL to the original spec we could add? > > Not really, their only "spec" is the log4j DTD and I didn't want to > write a link to that since it's buried in their site and could very > well move around. When I finish implementing our additions, I'm going > to circulate a log4perl DTD for comments and then include it in our > distribution. But I did add a note to see t/038XML-DOM1.t for examples. I see. Maybe a short example would illustrate it enough for new users to get the concept - - maybe even in the main Log4perl documentation, with a link to the "real" doc. When I get around to it ... -- -- Mike Mike Schilli log...@pe... |
From: Kevin G. <ke...@go...> - 2003-01-22 16:44:07
|
Mike Schilli wrote: > Somewhere in a log4j conf file sample you say > > log4j.appender.DBAppndr.filter_message = 1 > > but that should be a code ref, right? Doh! Should be "= 0 ", good catch, fixed, thanks. So if filter_message is undefined they get current behavior (join on ''), if it's 0/false then the list is left alone, if it's a coderef then the coderef is run on the list. (re: DOMConfigurator) >> > Also, is there a URL to the original spec we could add? >> >> Not really, their only "spec" is the log4j DTD... > > I see. Maybe a short example would illustrate it enough for new users to > get the concept - - maybe even in the main Log4perl documentation, with > a link to the "real" doc. When I get around to it ... Oh, that makes sense, but why didn't I think of it? I added an example to the SYNOPSIS. -- Happy Trails . . . Kevin M. Goess (and Anne and Frank) 904 Carmel Ave. Albany, CA 94706 (510) 525-5217 |