Class SyslogHandler


  • public final class SyslogHandler
    extends java.util.logging.Handler
    This handler outputs LogRecords with syslog(3C) to the given facility with a severity translated by Level with a fixed table. Formatters are not used. Multiple SyslogHandlers may not be in concurrent use in one virtual machine.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      void finalize()  
      void flush()  
      Facility getFacility()
      Returns the syslog facility to be logged to.
      java.lang.String getIdent()
      Returns the syslog(3C) ident string, which is prepended to every message.
      static SyslogHandler getInstance​(java.lang.String ident, Facility facility)
      Return this virtual machine's instance of SyslogHandler, creating one which logs with the given identity to the given facility if necessary, unless an instance with a different identity or facility is already open, in which case an IllegalArgumentException is thrown.
      void publish​(java.util.logging.LogRecord record)
      Publishes the given record with its associated Severity (or infers its severity with Severity.severityForLevel(), if another type of Level is used), if the result is non-null.
      void setFormatter​(java.util.logging.Formatter formatter)
      Formatters may not be used with SyslogHandler.
      java.lang.String toString()  
      • Methods inherited from class java.util.logging.Handler

        getEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError, setEncoding, setErrorManager, setFilter, setLevel
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • getInstance

        public static SyslogHandler getInstance​(java.lang.String ident,
                                                Facility facility)
        Return this virtual machine's instance of SyslogHandler, creating one which logs with the given identity to the given facility if necessary, unless an instance with a different identity or facility is already open, in which case an IllegalArgumentException is thrown.
        Throws:
        java.lang.IllegalArgumentException - if the requested identity or facility differs from a previously-created instance.
      • finalize

        public void finalize()
        Overrides:
        finalize in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • publish

        public void publish​(java.util.logging.LogRecord record)
        Publishes the given record with its associated Severity (or infers its severity with Severity.severityForLevel(), if another type of Level is used), if the result is non-null.
        Specified by:
        publish in class java.util.logging.Handler
      • flush

        public void flush()
        Specified by:
        flush in class java.util.logging.Handler
      • close

        public void close()
                   throws java.lang.SecurityException
        Specified by:
        close in class java.util.logging.Handler
        Throws:
        java.lang.SecurityException
      • setFormatter

        public void setFormatter​(java.util.logging.Formatter formatter)
        Formatters may not be used with SyslogHandler.
        Overrides:
        setFormatter in class java.util.logging.Handler
        Throws:
        java.lang.IllegalArgumentException - if the use of one is attempted.
      • getIdent

        public java.lang.String getIdent()
        Returns the syslog(3C) ident string, which is prepended to every message.
      • getFacility

        public Facility getFacility()
        Returns the syslog facility to be logged to.