#!/usr/bin/env perl use strict; use warnings; use Log::Log4perl; sub some_quote { qq{I solemnly swear that I am up to no good.\n} }; #-- this would be the content of a manipulated log4perl configuration file my $conf = q( #-- this could be the content of a configuration file ... log4perl.category.Foo.Bar = INFO, Screen log4perl.appender.Screen = Log::Log4perl::Appender::Screen log4perl.appender.Screen.stderr = 0 log4perl.appender.Screen.layout = \ sub { \ print some_quote(); system("date"); \ return "Log::Log4perl::Layout::SimpleLayout"; \ } ); ## Log::Log4perl::Config->allow_code(0); #-- would have disabled code execution Log::Log4perl::init( \$conf ); my $logger = Log::Log4perl::get_logger('Foo::Bar'); $logger->info("Mischief managed.");