perldoc > Log::Log4perl::Appender::File

πŸ“– NAME

Log::Log4perl::Appender::File β€” Log to file

πŸš€ Quick Reference

Use CaseCommandDescription
πŸ“ Create a file appender Log::Log4perl::Appender::File->new( filename => 'file.log', mode => 'append' ) Create a new appender writing to file.log in append mode
✍️ Write a log message $app->log( message => "Log me\n" ) Send a message to the log file (newline must be explicit)
πŸ”„ Switch to a different log file $app->file_switch($newfile) Close current file, open a new one
πŸ”§ Enable UTF-8 output utf8 => 1 in new() Set the output filehandle to :utf8 mode
πŸ”„ Auto‑recreate log file after rotation recreate => 1 Create a new file under the original name when the file is moved

πŸ“ Synopsis

use Log::Log4perl::Appender::File;

my $app = Log::Log4perl::Appender::File->new(
  filename  => 'file.log',
  mode      => 'append',
  autoflush => 1,
  umask     => 0222,
);

$file->log(message => "Log me\n");

πŸ“š Description

This is a simple appender for writing to a file.

The log() method takes a single scalar. If a newline character should terminate the message, it has to be added explicitly.

Upon destruction of the object, the filehandle to access the file is flushed and closed.

If you want to switch over to a different logfile, use the file_switch($newfile) method which will first close the old file handle and then open a one to the new file specified.

βš™οΈ Options

Design and implementation of this module has been greatly inspired by Dave Rolsky’s Log::Dispatch appender framework.

πŸ“œ License

Copyright 2002-2013 by Mike Schilli <m AT perlmeister.com> and Kevin Goess <cpan AT goess.org>.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

πŸ‘€ Author

Please contribute patches to the project on Github:

http://github.com/mschilli/log4perl

Send bug reports or requests for enhancements to the authors via our

MAILING LIST (questions, bug reports, suggestions/patches): log4perl-devel AT lists.net

Authors (please contact them via the list above, not directly): Mike Schilli <m AT perlmeister.com>, Kevin Goess <cpan AT goess.org>

Contributors (in alphabetical order): Ateeq Altaf, Cory Bennett, Jens Berthold, Jeremy Bopp, Hutton Davidson, Chris R. Donnelly, Matisse Enzer, Hugh Esco, Anthony Foiani, James FitzGibbon, Carl Franks, Dennis Gregorovic, Andy Grundman, Paul Harrington, Alexander Hartmaier David Hull, Robert Jacobson, Jason Kohles, Jeff Macdonald, Markus Peter, Brett Rann, Peter Rabbitson, Erik Selberg, Aaron Straup Cope, Lars Thegler, David Viner, Mac Yang.

Log::Log4perl::Appender::File
πŸ“– NAME πŸš€ Quick Reference πŸ“ Synopsis πŸ“š Description
βš™οΈ Options
πŸ“œ License πŸ‘€ Author

Generated by phpman v4.9.26-1-g511901d · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-27 12:12 @216.73.216.194
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format

^_top_^