0

I have Log::Log4perl config with two appenders to file and screen, like this:

  log4perl.logger.bc_log             = INFO, bc_log, console
  log4perl.appender.bc_log           = Log::Log4perl::Appender::File
  log4perl.appender.bc_log.filename  = bc.log
  log4perl.appender.bc_log.layout    = Log::Log4perl::Layout::PatternLayout
  log4perl.appender.bc_log.layout.ConversionPattern = %d{ISO8601}%d{Z} %H %m%n

  log4perl.appender.console           = Log::Log4perl::Appender::Screen
  log4perl.appender.console.stderr    = 1
  log4perl.appender.console.layout    = Log::Log4perl::Layout::PatternLayout
  log4perl.appender.console.layout.ConversionPattern = %m%n

In my program all output explicitly converted to utf8 (from cp1251 for example) and somewhere in my program:

my $bc_log = Log::Log4perl->get_logger('bc_log');
$bc_log->info('Some-utf8-encoded-string');

So message goes in utf8 both to file and console, but I would like utf8 for file and cp866 for console in one shot. I can't figure out is it possible in Log::Log4perl? Looks like Log::Log4perl::Appender::File has no encoding options.

gapsf
  • 634
  • 4
  • 8

1 Answers1

0

I created a new appender module (by copy original Log::Log4perl::Appender::Screen) with decoding/encoding added and use it insteed of Log::Log4perl::Appender::Screen in my code.

gapsf
  • 634
  • 4
  • 8