On Tue, Jul 03, 2007 at 10:43:30PM -0700, Mike Schilli wrote: > The warp_message option is only for appenders which can handle an array > ref instead of a message string. The DBI appender is the only example in > the L4p distribution. Or, you can write your own appender (if you look > at the screen appender or the FAQ, you'll see that this is trivial).
Thanks. I may decide to go this route. > This raises the question: What are you trying to do? Why do you need > warp_message? I don't see how you could use it in a meaningful way with > the default screen appender. I am trying to graft several fancy features onto log4perl. Notes: I think I could do 1 using warp_message. I suspect I _couldn't_ do 2 and 3, because the stack trace (%T) is not part of the @_ passed to the warp_message sub... but I hadn't gotten that far when I realized that Log::Log4perl::Appender::Screen doesn't support warp_message. Features: 1) Automagically use Data::Dumper on any references passed. E.g. if I do debug( 'The hash was ', \%hash, ' and the array was ', $array_ref ); I want log4perl to dump those refs for me. Laziness. :) 2) Limit stack traces by number of stack frames, not by number of characters. Actually, I think this would be a nice feature to add to log4perl sometime. What do you think? I see l4p uses Carp::longmess; if it used Devel::StackTrace, this would be easier. For now, I was just trying to kludge it in by doing a regex substitution on the whole longmess. 3) Filter out Catalyst internals from stack traces. This would also be easier with Devel::StackTrace, because it provides an ignore_package option (see http://search.cpan.org/~drolsky/Devel-StackTrace-1.15/lib/Devel/StackTrace.pm ). For now, I was planning to, again, regex-massage the stack trace. But, again, I'm not sure I even get access to the stack trace in the warp_message sub. Anyway... since warp_message doesn't seem to DWIM, I will probably implement these features by hacking or subclassing Catalyst::Log::Log4perl. It defines versions of debug, info, et cetera that enqueue your messages; then later its _flush method gets called and sends them on to log4perl. So I can hack the enqueueing methods to "warp" my message as I desire. I hope this message was interesting to someone. :) -- Quinn Weaver, independent contractor | President, San Francisco Perl Mongers http://fairpath.com/quinn/resume/ | http://sf.pm.org/ 510-520-5217 ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel