in reply to What is the best way to dump data structures to logfiles?

You really haven't given all your requirements here, so I apologize if this is a useless suggestion.

I've had success using Data::Dumper or YAML (or its XS replacement YAML::Syck) to dump structures to a file, which is then referenced in the log file. I use a sub that looks something like:

# assumes-> use File::Temp ':POSIX'; for tempnam() # assumes-> use YAML 'Dump'; (or) use YAML::Syck 'Dump'; for Dump() sub dump { my $message = shift; my $structures = scalar @_; # yes, 'scalar' is redudant, but reada +ble # create file in curdir with prefix 'dump.' my ($dump_h, $dump_n) = tempnam('.','dump.'); print $dump_h, Dump($_) for @_; close $dump_h; $message.=sprintf '(%d dumped to "%s")', $structures, $dump_n; }

And would be called something like:

$logger->fatal( dump('Unable to foo, dumping object $foo_doer.', $foo_ +doer) );

The log line would look something like:

20070314 15:09 FATAL: Unable to foo, dumping object $foo_doer.(1 dumpe +d to "dump.foobar1")

And the file "dump.foobar1" would contain the $foo_doer serialization.

You can equally use Data::Dumper or any other serialization module you prefer using this model.

Ramblings and references
The Code that can be seen is not the true Code
I haven't found a problem yet that can't be solved by a well-placed trebuchet