Package org.jpos.util

Class DailyLogListener

    • Constructor Detail

      • DailyLogListener

        public DailyLogListener()
        Creates a new instance of DailyLogListener
    • Method Detail

      • setConfiguration

        public void setConfiguration​(Configuration cfg)
                              throws ConfigurationException
        Description copied from class: RotateLogListener
        Configure this RotateLogListener
        Properties:
        • file base log filename
        • [window] in seconds (default 0 - never rotate)
        • [count] number of copies (default 0 == single copy)
        • [maxsize] max log size in bytes (approx)
        • [rotate-on-startup] Rotate file on q2 startup (default: false)
        • [file-name-pattern] Comma-delimited codes for positional token replacement (case sensitive)

        Currently supported file-pattern-codes:

        • h - hostname lookup

        When code replacement fails, the token will be replaced by the code preceded by a # to give an indication of what failed. This type of failure will not result in a startup failure.

        file is expected to contain %s tokens for replacement when enabled, as expected by String.format.

        Specified by:
        setConfiguration in interface Configurable
        Overrides:
        setConfiguration in class RotateLogListener
        Parameters:
        cfg - Configuration
        Throws:
        ConfigurationException
      • deleteOldLogs

        public void deleteOldLogs()
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • getSuffix

        public java.lang.String getSuffix()
        Getter for property suffix.
        Returns:
        Value of property suffix.
      • setSuffix

        public void setSuffix​(java.lang.String suffix)
        Setter for property suffix.
        Parameters:
        suffix - New value of property suffix.
      • getPrefix

        public java.lang.String getPrefix()
        Getter for property prefix.
        Returns:
        Value of property prefix.
      • setPrefix

        public void setPrefix​(java.lang.String prefix)
        Setter for property prefix.
        Parameters:
        prefix - New value of property prefix.
      • getRotateCount

        public int getRotateCount()
        Getter for property rotateCount.
        Returns:
        Value of property rotateCount.
      • setRotateCount

        public void setRotateCount​(int rotateCount)
        Setter for property rotateCount.
        Parameters:
        rotateCount - New value of property rotateCount.
      • getDateFmt

        public java.text.DateFormat getDateFmt()
        Getter for property dateFmt.
        Returns:
        Value of property dateFmt.
      • setDateFmt

        public void setDateFmt​(java.text.DateFormat dateFmt)
        Setter for property dateFmt.
        Parameters:
        dateFmt - New value of property dateFmt.
      • getLastDate

        public java.lang.String getLastDate()
        Getter for property lastDate.
        Returns:
        Value of property lastDate.
      • setLastDate

        public void setLastDate​(java.lang.String lastDate)
        Setter for property lastDate.
        Parameters:
        lastDate - New value of property lastDate.
      • getCompressedSuffix

        public java.lang.String getCompressedSuffix()
        Getter for property compressedExt.
        Returns:
        Value of property compressedExt.
      • setCompressedSuffix

        public void setCompressedSuffix​(java.lang.String compressedSuffix)
        Setter for property compressedExt.
        Parameters:
        compressedSuffix - New value of property compressedExt.
      • getMaxAge

        public long getMaxAge()
        Getter for property maxAge.
        Returns:
        Value of property maxAge.
      • setMaxAge

        public void setMaxAge​(long maxAge)
        Setter for property maxAge.
        Parameters:
        maxAge - new value of property maxAge.
      • getDeleteRegex

        public java.lang.String getDeleteRegex()
        Getter for property deleteRegex.
        Returns:
        Value of property deleteRegex.
      • setDeleteRegex

        public void setDeleteRegex​(java.lang.String deleteRegex)
        Setter for property deleteRegex.
        Parameters:
        deleteRegex - new value of property deleteRegex.
      • getCompressorThread

        protected java.lang.Thread getCompressorThread​(java.io.File f)
        Hook method that creates a thread to compress the file f.
        Parameters:
        f - the file name
        Returns:
        a thread to compress the file and null if it is not necessary
      • getCompressedOutputStream

        protected java.io.OutputStream getCompressedOutputStream​(java.io.File f)
                                                          throws java.io.IOException
        Hook method that creates an output stream that will compress the data.
        Parameters:
        f - the file name
        Returns:
        ZIP/GZip OutputStream
        Throws:
        java.io.IOException - on error
      • closeCompressedOutputStream

        protected void closeCompressedOutputStream​(java.io.OutputStream os)
                                            throws java.io.IOException
        Throws:
        java.io.IOException
      • logDebugEx

        protected void logDebugEx​(java.lang.String msg,
                                  java.lang.Throwable e)
      • getCompressionFormat

        public int getCompressionFormat()
        Getter for property compressionFormat.
        Returns:
        Value of property compressionFormat.
      • setCompressionFormat

        public void setCompressionFormat​(int compressionFormat)
        Setter for property compressionFormat.
        Parameters:
        compressionFormat - New value of property compressionFormat.
      • getCompressionBufferSize

        public int getCompressionBufferSize()
        Getter for property compressionBufferSize.
        Returns:
        Value of property compressionBufferSize.
      • setCompressionBufferSize

        public void setCompressionBufferSize​(int compressionBufferSize)
        Setter for property compressionBufferSize.
        Parameters:
        compressionBufferSize - New value of property compressionBufferSize.
      • compress

        protected void compress​(java.io.File logFile)
        Hook method to optionally compress the file
        Parameters:
        logFile - the file name