{
    "mode": "perldoc",
    "parameter": "Log::Dispatch::File",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Log%3A%3ADispatch%3A%3AFile/json",
    "generated": "2026-06-09T18:08:50Z",
    "synopsis": "use Log::Dispatch;\nmy $log = Log::Dispatch->new(\noutputs => [\n[\n'File',\nminlevel => 'info',\nfilename  => 'Somefile.log',\nmode      => '>>',\nnewline   => 1\n]\n],\n);\n$log->emerg(\"I've fallen and I can't get up\");",
    "sections": {
        "NAME": {
            "content": "Log::Dispatch::File - Object for logging to files\n",
            "subsections": []
        },
        "VERSION": {
            "content": "version 2.70\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use Log::Dispatch;\n\nmy $log = Log::Dispatch->new(\noutputs => [\n[\n'File',\nminlevel => 'info',\nfilename  => 'Somefile.log',\nmode      => '>>',\nnewline   => 1\n]\n],\n);\n\n$log->emerg(\"I've fallen and I can't get up\");\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This module provides a simple object for logging to files under the Log::Dispatch::* system.\n\nNote that a newline will *not* be added automatically at the end of a message by default. To do\nthat, pass \"newline => 1\".\n\nNOTE: If you are writing to a single log file from multiple processes, the log output may become\ninterleaved and garbled. Use the Log::Dispatch::File::Locked output instead, which allows\nmultiple processes to safely share a single file.\n",
            "subsections": []
        },
        "CONSTRUCTOR": {
            "content": "The constructor takes the following parameters in addition to the standard parameters documented\nin Log::Dispatch::Output:\n\n*   filename ($)\n\nThe filename to be opened for writing.\n\n*   mode ($)\n\nThe mode the file should be opened with. Valid options are 'write', '>', 'append', '>>', or\nthe relevant constants from Fcntl. The default is 'write'.\n\n*   binmode ($)\n\nA layer name to be passed to binmode, like \":encoding(UTF-8)\" or \":raw\".\n\n*   closeafterwrite ($)\n\nWhether or not the file should be closed after each write. This defaults to false.\n\nIf this is true, then the mode will always be append, so that the file is not re-written for\neach new message.\n\n*   lazyopen ($)\n\nWhether or not the file should be opened only on first write. This defaults to false.\n\n*   autoflush ($)\n\nWhether or not the file should be autoflushed. This defaults to true.\n\n*   syswrite ($)\n\nWhether or not to perform the write using \"syswrite\" in perlfunc(), as opposed to \"print\" in\nperlfunc(). This defaults to false. The usual caveats and warnings as documented in\n\"syswrite\" in perlfunc apply.\n\n*   permissions ($)\n\nIf the file does not already exist, the permissions that it should be created with.\nOptional. The argument passed must be a valid octal value, such as 0600 or the constants\navailable from Fcntl, like SIRUSR|SIWUSR.\n\nSee \"chmod\" in perlfunc for more on potential traps when passing octal values around. Most\nimportantly, remember that if you pass a string that looks like an octal value, like this:\n\nmy $mode = '0644';\n\nThen the resulting file will end up with permissions like this:\n\n--w----r-T\n\nwhich is probably not what you want.\n",
            "subsections": []
        },
        "SUPPORT": {
            "content": "Bugs may be submitted at <https://github.com/houseabsolute/Log-Dispatch/issues>.\n\nI am also usually active on IRC as 'autarch' on \"irc://irc.perl.org\".\n",
            "subsections": []
        },
        "SOURCE": {
            "content": "The source code repository for Log-Dispatch can be found at\n<https://github.com/houseabsolute/Log-Dispatch>.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Dave Rolsky <autarch@urth.org>\n",
            "subsections": []
        },
        "COPYRIGHT AND LICENSE": {
            "content": "This software is Copyright (c) 2020 by Dave Rolsky.\n\nThis is free software, licensed under:\n\nThe Artistic License 2.0 (GPL Compatible)\n\nThe full text of the license can be found in the LICENSE file included with this distribution.\n",
            "subsections": []
        }
    },
    "summary": "Log::Dispatch::File - Object for logging to files",
    "flags": [],
    "examples": [],
    "see_also": []
}