From: Mike S. <msc...@ao...> - 2003-09-23 16:21:42
|
Rit...@ub... wrote: > I have created my own socket appender using Dispatch::Output. I want > to give the layout inside my appender so that no user can change it. > I want to set everything from config file except the layout part. > It gives me error from Config.pm...Layout not specified for appender. While the configuration file will need to have a layout defined for every appender, the solution to your problem is to override this layout in your application: use Log::Log4perl qw(:easy); Log::Log4perl->init(\ <<'EOT'); log4perl.category = WARN, Screen log4perl.appender.Screen = Log::Log4perl::Appender::Screen log4perl.appender.Screen.layout = \ Log::Log4perl::Layout::PatternLayout log4perl.appender.Screen.layout.ConversionPattern = %d %F{1} %L> %m %n EOT my $appenders = Log::Log4perl->appenders(); my $layout = Log::Log4perl::Layout::PatternLayout->new("%m %m%n"); $appenders->{Screen}->layout($layout); WARN("test message"); __END__ -- -- Mike Mike Schilli m...@pe... |