# perldoc > Log::Dispatch::Syslog

## NAME
    [Log::Dispatch::Syslog](https://www.chedong.com/phpMan.php/perldoc/Log%3A%3ADispatch%3A%3ASyslog/markdown) - Object for logging to system log.

## VERSION
    version 2.71

## SYNOPSIS
      use [Log::Dispatch](https://www.chedong.com/phpMan.php/perldoc/Log%3A%3ADispatch/markdown);

      my $log = [Log::Dispatch](https://www.chedong.com/phpMan.php/perldoc/Log%3A%3ADispatch/markdown)->new(
          outputs => [
              [
                  'Syslog',
                  min_level => 'info',
                  ident     => 'Yadda yadda'
              ]
          ]
      );

      $log->emerg("Time to die.");

## DESCRIPTION
    This module provides a simple object for sending messages to the system log (via UNIX syslog
    calls).

    Note that logging may fail if you try to pass UTF-8 characters in the log message. If logging
    fails and warnings are enabled, the error message will be output using Perl's "warn".

## CONSTRUCTOR
    The constructor takes the following parameters in addition to the standard parameters documented
    in [Log::Dispatch::Output](https://www.chedong.com/phpMan.php/perldoc/Log%3A%3ADispatch%3A%3AOutput/markdown):

    *   ident ($)

        This string will be prepended to all messages in the system log. Defaults to $0.

    *   logopt ($)

        A string containing the log options (separated by any separator you like). See the
        [openlog(3)](https://www.chedong.com/phpMan.php/man/openlog/3/markdown) and [Sys::Syslog](https://www.chedong.com/phpMan.php/perldoc/Sys%3A%3ASyslog/markdown) docs for more details. Defaults to ''.

    *   facility ($)

        Specifies what type of program is doing the logging to the system log. Valid options are
        'auth', 'authpriv', 'cron', 'daemon', 'kern', 'local0' through 'local7', 'mail, 'news',
        'syslog', 'user', 'uucp'. Defaults to 'user'

    *   socket ($, \@, or \%)

        Tells what type of socket to use for sending syslog messages. Valid options are listed in
        "[Sys::Syslog](https://www.chedong.com/phpMan.php/perldoc/Sys%3A%3ASyslog/markdown)".

        If you don't provide this, then we let "[Sys::Syslog](https://www.chedong.com/phpMan.php/perldoc/Sys%3A%3ASyslog/markdown)" simply pick one that works, which is
        the preferred option, as it makes your code more portable.

        If you pass an array reference, it is dereferenced and passed to [Sys::Syslog::setlogsock](https://www.chedong.com/phpMan.php/perldoc/Sys%3A%3ASyslog%3A%3Asetlogsock/markdown)().

        If you pass a hash reference, it is passed to [Sys::Syslog::setlogsock](https://www.chedong.com/phpMan.php/perldoc/Sys%3A%3ASyslog%3A%3Asetlogsock/markdown)() as is.

    *   lock ($)

        If this is set to a true value, then the calls to setlogsock(), openlog(), syslog(), and
        closelog() will all be guarded by a thread-locked variable.

        This is only relevant when running you are using Perl threads in your application. Setting
        this to a true value will cause the threads and [threads::shared](https://www.chedong.com/phpMan.php/perldoc/threads%3A%3Ashared/markdown) modules to be loaded.

        This defaults to false.

## SUPPORT
    Bugs may be submitted at <<https://github.com/houseabsolute/Log-Dispatch/issues>>.

## SOURCE
    The source code repository for Log-Dispatch can be found at
    <<https://github.com/houseabsolute/Log-Dispatch>>.

## AUTHOR
    Dave Rolsky <<autarch@urth.org>>

## COPYRIGHT AND LICENSE
    This software is Copyright (c) 2023 by Dave Rolsky.

    This is free software, licensed under:

      The Artistic License 2.0 (GPL Compatible)

    The full text of the license can be found in the LICENSE file included with this distribution.

