in reply to Re: Can I from within a module access variables from the calling program?
in thread Can I from within a module access variables from the calling program?
Also heed the security warning in the FAQ item I linked above, and circumvent the security issue with a custom appender like (the untested):
So log4perl.appender.myFILE = Log::Log4perl::Appender::HJOfilnamed gets you a MyApp.myFILE.2012-10-29T02-40-04Z.logpackage Log::Log4perl::Appender::HJOfilnamed; use parent qw[ Log::Log4perl::Appender::File ]; use POSIX(); sub new { my $class = shift; my %opts = @_; my $tim = POSIX::strftime('%Y-%m-%dT%H-%M-%SZ', gmtime); my $fname = join '.', grep defined, $opts{name}, $opts{appender}, +$tim, 'log'; $fname =~ s{::}{.}g; $fname =~ s{[^0-9a-zA-Z\-\+\.}{}g; $fname = $1 if $fname =~ /^(.*)$/ return $class->new( @_, filename => $fname ); }
You'd probably want to set other defaults to your liking :)( layout, mode, ... )
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Can I from within a module access variables from the calling program?
by HJO (Acolyte) on Oct 29, 2012 at 10:31 UTC | |
by Anonymous Monk on Oct 29, 2012 at 10:47 UTC | |
by HJO (Acolyte) on Oct 29, 2012 at 11:48 UTC | |
by Anonymous Monk on Oct 29, 2012 at 12:34 UTC | |
by Anonymous Monk on Oct 29, 2012 at 12:38 UTC | |
|