{
    "content": [
        {
            "type": "text",
            "text": "# Log::Log4perl::Appender::File (perldoc)\n\n## NAME\n\nLog::Log4perl::Appender::File - Log to file\n\n## SYNOPSIS\n\nuse Log::Log4perl::Appender::File;\nmy $app = Log::Log4perl::Appender::File->new(\nfilename  => 'file.log',\nmode      => 'append',\nautoflush => 1,\numask     => 0222,\n);\n$file->log(message => \"Log me\\n\");\n\n## DESCRIPTION\n\nThis is a simple appender for writing to a file.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **LICENSE**\n- **AUTHOR**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Log::Log4perl::Appender::File",
        "section": "",
        "mode": "perldoc",
        "summary": "Log::Log4perl::Appender::File - Log to file",
        "synopsis": "use Log::Log4perl::Appender::File;\nmy $app = Log::Log4perl::Appender::File->new(\nfilename  => 'file.log',\nmode      => 'append',\nautoflush => 1,\numask     => 0222,\n);\n$file->log(message => \"Log me\\n\");",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 11,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 135,
                "subsections": []
            },
            {
                "name": "LICENSE",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 17,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Log::Log4perl::Appender::File - Log to file\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use Log::Log4perl::Appender::File;\n\nmy $app = Log::Log4perl::Appender::File->new(\nfilename  => 'file.log',\nmode      => 'append',\nautoflush => 1,\numask     => 0222,\n);\n\n$file->log(message => \"Log me\\n\");\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This is a simple appender for writing to a file.\n\nThe \"log()\" method takes a single scalar. If a newline character should terminate the message,\nit has to be added explicitly.\n\nUpon destruction of the object, the filehandle to access the file is flushed and closed.\n\nIf you want to switch over to a different logfile, use the \"fileswitch($newfile)\" method which\nwill first close the old file handle and then open a one to the new file specified.\n\nOPTIONS\nfilename\nName of the log file.\n\nmode\nMessages will be append to the file if $mode is set to the string \"append\". Will clobber the\nfile if set to \"clobber\". If it is \"pipe\", the file will be understood as executable to pipe\noutput to. Default mode is \"append\".\n\nautoflush\n\"autoflush\", if set to a true value, triggers flushing the data out to the file on every\ncall to \"log()\". \"autoflush\" is on by default.\n\nsyswrite\n\"syswrite\", if set to a true value, makes sure that the appender uses syswrite() instead of\nprint() to log the message. \"syswrite()\" usually maps to the operating system's \"write()\"\nfunction and makes sure that no other process writes to the same log file while \"write()\" is\nbusy. Might safe you from having to use other synchronisation measures like semaphores (see:\nSynchronized appender).\n\numask\nSpecifies the \"umask\" to use when creating the file, determining the file's permission\nsettings. If set to 0022 (default), new files will be created with \"rw-r--r--\" permissions.\nIf set to 0000, new files will be created with \"rw-rw-rw-\" permissions.\n\nowner\nIf set, specifies that the owner of the newly created log file should be different from the\neffective user id of the running process. Only makes sense if the process is running as\nroot. Both numerical user ids and user names are acceptable. Log4perl does not attempt to\nchange the ownership of *existing* files.\n\ngroup\nIf set, specifies that the group of the newly created log file should be different from the\neffective group id of the running process. Only makes sense if the process is running as\nroot. Both numerical group ids and group names are acceptable. Log4perl does not attempt to\nchange the group membership of *existing* files.\n\nutf8\nIf you're printing out Unicode strings, the output filehandle needs to be set into \":utf8\"\nmode:\n\nmy $app = Log::Log4perl::Appender::File->new(\nfilename  => 'file.log',\nmode      => 'append',\nutf8      => 1,\n);\n\nbinmode\nTo manipulate the output filehandle via \"binmode()\", use the binmode parameter:\n\nmy $app = Log::Log4perl::Appender::File->new(\nfilename  => 'file.log',\nmode      => 'append',\nbinmode   => \":utf8\",\n);\n\nA setting of \":utf8\" for \"binmode\" is equivalent to specifying the \"utf8\" option (see\nabove).\n\nrecreate\nNormally, if a file appender logs to a file and the file gets moved to a different location\n(e.g. via \"mv\"), the appender's open file handle will automatically follow the file to the\nnew location.\n\nThis may be undesirable. When using an external logfile rotator, for example, the appender\nshould create a new file under the old name and start logging into it. If the \"recreate\"\noption is set to a true value, \"Log::Log4perl::Appender::File\" will do exactly that. It\ndefaults to false. Check the \"recreatecheckinterval\" option for performance optimizations\nwith this feature.\n\nrecreatecheckinterval\nIn \"recreate\" mode, the appender has to continuously check if the file it is logging to is\nstill in the same location. This check is fairly expensive, since it has to call \"stat\" on\nthe file name and figure out if its inode has changed. Doing this with every call to \"log\"\ncan be prohibitively expensive. Setting it to a positive integer value N will only check the\nfile every N seconds. It defaults to 30.\n\nThis obviously means that the appender will continue writing to a moved file until the next\ncheck occurs, in the worst case this will happen \"recreatecheckinterval\" seconds after the\nfile has been moved or deleted. If this is undesirable, setting \"recreatecheckinterval\" to\n0 will have the appender check the file with *every* call to \"log()\".\n\nrecreatechecksignal\nIn \"recreate\" mode, if this option is set to a signal name (e.g. \"USR1\"), the appender will\nrecreate a missing logfile when it receives the signal. It uses less resources than constant\npolling. The usual limitation with perl's signal handling apply. Check the FAQ for using\nthis option with the log rotating utility \"newsyslog\".\n\nrecreatepidwrite\nThe popular log rotating utility \"newsyslog\" expects a pid file in order to send the\napplication a signal when its logs have been rotated. This option expects a path to a file\nwhere the pid of the currently running application gets written to. Check the FAQ for using\nthis option with the log rotating utility \"newsyslog\".\n\ncreateatlogtime\nThe file appender typically creates its logfile in its constructor, i.e. at Log4perl\n\"init()\" time. This is desirable for most use cases, because it makes sure that file\npermission problems get detected right away, and not after days/weeks/months of operation\nwhen the appender suddenly needs to log something and fails because of a problem that was\nobvious at startup.\n\nHowever, there are rare use cases where the file shouldn't be created at Log4perl \"init()\"\ntime, e.g. if the appender can't be used by the current user although it is defined in the\nconfiguration file. If you set \"createatlogtime\" to a true value, the file appender will\ntry to create the file at log time. Note that this setting lets permission problems sit\nundetected until log time, which might be undesirable.\n\nheadertext\nIf you want Log4perl to print a header into every newly opened (or re-opened) logfile, set\n\"headertext\" to either a string or a subroutine returning a string. If the message doesn't\nhave a newline, a newline at the end of the header will be provided.\n\nmkpath\nIf this this option is set to true, the directory path will be created if it does not exist\nyet.\n\nmkpathumask\nSpecifies the \"umask\" to use when creating the directory, determining the directory's\npermission settings. If set to 0022 (default), new directory will be created with\n\"rwxr-xr-x\" permissions. If set to 0000, new directory will be created with \"rwxrwxrwx\"\npermissions.\n\nDesign and implementation of this module has been greatly inspired by Dave Rolsky's\n\"Log::Dispatch\" appender framework.\n",
                "subsections": []
            },
            "LICENSE": {
                "content": "Copyright 2002-2013 by Mike Schilli <m@perlmeister.com> and Kevin Goess <cpan@goess.org>.\n\nThis library is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Please contribute patches to the project on Github:\n\nhttp://github.com/mschilli/log4perl\n\nSend bug reports or requests for enhancements to the authors via our\n\nMAILING LIST (questions, bug reports, suggestions/patches): log4perl-devel@lists.sourceforge.net\n\nAuthors (please contact them via the list above, not directly): Mike Schilli\n<m@perlmeister.com>, Kevin Goess <cpan@goess.org>\n\nContributors (in alphabetical order): Ateeq Altaf, Cory Bennett, Jens Berthold, Jeremy Bopp,\nHutton Davidson, Chris R. Donnelly, Matisse Enzer, Hugh Esco, Anthony Foiani, James FitzGibbon,\nCarl Franks, Dennis Gregorovic, Andy Grundman, Paul Harrington, Alexander Hartmaier David Hull,\nRobert Jacobson, Jason Kohles, Jeff Macdonald, Markus Peter, Brett Rann, Peter Rabbitson, Erik\nSelberg, Aaron Straup Cope, Lars Thegler, David Viner, Mac Yang.\n",
                "subsections": []
            }
        }
    }
}