Controlling logging
===================

Failover Manager writes and stores one log file per agent in
``/var/log/efm-<version>/`` .

You can control the level of detail written to the agent log by
modifying the ``jgroups.loglevel`` , ``efm.loglevel`` , and
``jdbc.loglevel`` parameters in the :ref:`The cluster properties file <The cluster properties file>`  :

.. code:: ini


   #  Logging levels for JGroups and EFM.

   #  Valid values are: TRACE, DEBUG, INFO, WARN, ERROR

   #  Default value: INFO

   #  It is not necessary to increase these values unless debugging a specific

   #  issue. If nodes are not discovering each other at startup, increasing

   #  the jgroups level to DEBUG will show information about the TCP connection

   #  attempts that may help diagnose the connection failures.

   #  If there are issues with creating database connections, increasing

   #  the jdbc.loglevel level will show more information.

   #  TRACE level logging should be used for diagnosing problems only.

   #  It is not supported for production use.

   jgroups.loglevel=INFO
   efm.loglevel=INFO
   jdbc.loglevel=INFO

The logging facilities use the Java logging library and logging levels.
The log levels, in order from most logging output to least, are:

- ``TRACE``

- ``DEBUG``

- ``INFO``

- ``WARN``

- ``ERROR``

For example, if you set the ``efm.loglevel`` parameter to ``WARN`` ,
Failover Manager only logs messages at the ``WARN`` level and above,
that is, ``WARN`` and ``ERROR`` .

!!!important TRACE level logging should only be used when diagnosing
specific problems. It causes more work for the Failover Manager agent
and the behavior with this level of logging is not defined. It is not
supported for production use.

By default, Failover Manager log files are rotated daily, compressed,
and stored for a week. You can modify the file rotation schedule by
changing settings in the log rotation file
(``/etc/logrotate.d/efm-5.<x>`` ). For more information about modifying
the log rotation schedule, consult the logrotate man page:

.. code:: shell

   $ man logrotate

Enabling syslog log file entries
--------------------------------

Failover Manager supports syslog logging. To implement syslog logging,
you must configure syslog to allow UDP or TCP connections.

To allow a connection to syslog, edit the ``/etc/rsyslog.conf`` file and
uncomment the protocol you want to use. Also make sure that the
``UDPServerRun`` or ``TCPServerRun`` entry associated with the protocol
includes the port number to which log entries are sent. For example, the
following configuration file entries enable UDP connections to port 514:

.. code:: shell


   #  Provides UDP syslog reception

   $ModLoad imudp
   $UDPServerRun 514

The following configuration file entries enable TCP connections to port
514:

.. code:: shell


   #  Provides TCP syslog reception

   $ModLoad imtcp
   $InputTCPServerRun 514

After modifying the syslog configuration file, restart the ``rsyslog``
service to enable the connections:

   ``systemctl restart rsyslog.service``

After modifying the ``rsyslog.conf`` file on the Failover Manager host,
modify the Failover Manager properties to enable logging. Use your
choice of editor to :ref:`modify the properties file <The cluster properties file>` 
``/etc/edb/efm-5.<x>/efm.properties.in`` , specifying the type of
logging that you want to implement:

.. code:: ini


   #  Which logging is enabled.

   file.log.enabled=true
   syslog.enabled=false

You must also :ref:`specify syslog details <The cluster properties file>`  for your system. Use the ``syslog.protocol``
parameter to specify the protocol type (UDP or TCP) and the
``syslog.port`` parameter to specify the listener port of the syslog
host. You can use the ``syslog.facility`` value as an identifier for the
process that created the entry. Use a value between ``LOCAL0`` and
``LOCAL7`` .

.. code:: ini


   #  Syslog information. The syslog service must be listening # on the

    port for the given protocol, which can be UDP or

   #  TCP. The facilities supported are LOCAL0 through LOCAL7.

   #  syslog.host=localhost

   syslog.port=514
   syslog.protocol=UDP
   syslog.facility=LOCAL1

For more information about syslog, see the syslog man page:

``man syslog``
