Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

net::daemon::log(3pm) [linux man page]

Net::Daemon::Log(3pm)					User Contributed Perl Documentation				     Net::Daemon::Log(3pm)

NAME
Net::Daemon::Log - Utility functions for logging SYNOPSIS
# Choose logging method: syslog or Win32::EventLog $self->{'facility'} = 'mail'; # Default: Daemon $self->{'logfile'} = undef; # Default # Choose logging method: stderr $self->{'logfile'} = 1; # Choose logging method: IO handle my $file = IO::File->new("my.log", "a"); $self->{'logfile'} = $file; # Debugging messages (equivalent): $self->Log('debug', "This is a debugging message"); $self->Debug("This is a debugging message"); # Error messages (equivalent): $self->Log('err', "This is an error message"); $self->Error("This is an error message"); # Fatal error messages (implies 'die') $self->Fatal("This is a fatal error message"); WARNING
THIS IS ALPHA SOFTWARE. It is *only* 'Alpha' because the interface (API) is not finalised. The Alpha status does not reflect code quality or stability. DESCRIPTION
Net::Daemon::Log is a utility class for portable logging messages. By default it uses syslog (Unix) or Win32::EventLog (Windows), but logging messages can also be redirected to stderr or a log file. Generic Logging $self->Log($level, $msg, @args); This is the generic interface. The logging level is in syslog style, thus one of the words 'debug', 'info', 'notice', 'err' or 'crit'. You'll rarely need info and notice and I can hardly imagine a reason for crit (critical). In 95% of all cases debug and err will be sufficient. The logging string $msg is a format string similar to printf. Utility methods $self->Debug($msg, @args); $self->Error($msg, @args); $self->Fatal($msg, @args); These are replacements for logging with levels debug and err. The difference between the latter two is that Fatal includes throwing a Perl exception. Chossing a logging target By default logging will happen to syslog (Unix) or EventLog (Windows). However you may choose logging to stderr by setting $self->{'logfile'} = 1; This is required if neither of syslog and EventLog is available. An alternative option is setting $self->{'logfile'} = $handle; where $handle is any object supporting a print method, for example an IO::Handle object. Usually the logging target is choosen as soon as you call $self->Log() the first time. However, you may force choosing the target by doing a $self->OpenLog(); before calling Log the first time. MULTITHREADING
The Multithreading capabitities of this class are depending heavily on the underlying classes Sys::Syslog, Win32::EventLog or IO::Handle. If they are thread safe, you can well assume that this package is too. (The exception being that you should better call $self->OpenLog() before threading.) AUTHOR AND COPYRIGHT
Net::Daemon is Copyright (C) 1998, Jochen Wiedmann Am Eisteich 9 72555 Metzingen Germany Phone: +49 7123 14887 Email: joe@ispsoft.de All rights reserved. You may distribute this package under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file. SEE ALSO
Net::Daemon(3), Sys::Syslog(3), Win32::EventLog(3), IO::Handle(3) perl v5.12.3 2011-03-01 Net::Daemon::Log(3pm)

Check Out this Related Man Page

Net::Server::Log::Sys::Syslog(3)			User Contributed Perl Documentation			  Net::Server::Log::Sys::Syslog(3)

NAME
Net::Server::Log::Sys::Syslog - log via Syslog SYNOPSIS
use base qw(Net::Server::PreFork); __PACKAGE__->run( log_file => 'Sys::Syslog', syslog_ident => 'myapp', ); DESCRIPTION
This module provides Sys::Syslog logging to the Net::Server system. CONFIGURATION
log_file To begin using Sys::Syslog logging, simply set the Net::Server log_file configuration parameter to "Sys::Syslog". If the magic name "Sys::Syslog" is used, all logging will take place via the Sys::Syslog module. If syslog is used the parameters "syslog_logsock", "syslog_ident", and "syslog_logopt",and "syslog_facility" may also be defined. syslog_logsock Only available if "log_file" is equal to "Sys::Syslog". May be either unix, inet, native, console, stream, udp, or tcp, or an arrayref of the types to try. Default is "unix" if the version of Sys::Syslog < 0.15 - otherwise the default is to not call setlogsock. See Sys::Syslog. syslog_ident Only available if "log_file" is equal to "Sys::Syslog". Id to prepend on syslog entries. Default is "net_server". See Sys::Syslog. syslog_logopt Only available if "log_file" is equal to "Sys::Syslog". May be either zero or more of "pid","cons","ndelay","nowait". Default is "pid". See Sys::Syslog. syslog_facility Only available if "log_file" is equal to "Sys::Syslog". See Sys::Syslog and syslog. Default is "daemon". DEFAULT ARGUMENTS FOR Net::Server The following arguments are available in the default "Net::Server" or "Net::Server::Single" modules. (Other personalities may use additional parameters and may optionally not use parameters from the base class.) Key Value Default ## syslog parameters (if log_file eq Sys::Syslog) syslog_logsock (native|unix|inet|udp |tcp|stream|console) unix (on Sys::Syslog < 0.15) syslog_ident "identity" "net_server" syslog_logopt (cons|ndelay|nowait|pid) pid syslog_facility w+ daemon METHODS
"initialize" This method is called during the initilize_logging method of Net::Server. It returns a single code ref that will be stored under the log_function property of the Net::Server object. That code ref takes log_level and message as arguments and calls the initialized log4perl system. "handle_log_error" This method is called if the log_function fails for some reason. It is passed the Net::Server object, the error that occurred while logging and an arrayref containing the log level and the message. In turn, this calls the legacy Net::Server::handle_syslog_error method. LICENCE
Distributed under the same terms as Net::Server perl v5.18.2 2013-01-09 Net::Server::Log::Sys::Syslog(3)
Man Page