Class GlassFishLogHandler

java.lang.Object
java.util.logging.Handler
java.util.logging.StreamHandler
org.glassfish.main.jul.handler.GlassFishLogHandler
All Implemented Interfaces:
ExternallyManagedLogHandler

public class GlassFishLogHandler extends StreamHandler implements ExternallyManagedLogHandler
GlassFish log handler
  • can redirect output going through STDOUT and STDERR
  • buffers log records
WARNING: If you configure this handler to redirect standard output, you have to prevent the situation when any other handler would use it.
Author:
David Matejcek, Jerome Dochez (original concepts of GFFileHandler), Carla Mott (original concepts of GFFileHandler)
  • Constructor Details

  • Method Details

    • createGlassFishLogHandlerConfiguration

      public static GlassFishLogHandlerConfiguration createGlassFishLogHandlerConfiguration(Class<? extends GlassFishLogHandler> handlerClass)
      Creates the configuration object for this class or it's descendants.
      Parameters:
      handlerClass -
      Returns:
      the configuration parsed from the property file, usable to call the reconfigure(GlassFishLogHandlerConfiguration) method.
    • isReady

      public boolean isReady()
      Specified by:
      isReady in interface ExternallyManagedLogHandler
      Returns:
      true if the configuration is complete and the handler is capable to immediately start processing the data.
    • getConfiguration

      public GlassFishLogHandlerConfiguration getConfiguration()
      Returns:
      clone of the internal configuration
    • reconfigure

      public void reconfigure(GlassFishLogHandlerConfiguration newConfiguration)
      Reconfigures the handler: first cancels scheduled rotation of the output file, then stops the output. After that replaces the original configuration with the argument and starts the output again - if it fails, turns off completely including accepting new records and throws the exception.
      Parameters:
      newConfiguration -
    • setOutputStream

      public void setOutputStream(OutputStream out) throws SecurityException
      Overrides:
      setOutputStream in class StreamHandler
      Throws:
      SecurityException
    • publish

      public void publish(LogRecord record)
      Does not publish the record, but puts it into the queue buffer to be processed by an internal thread.
      Overrides:
      publish in class StreamHandler
    • isLoggable

      public boolean isLoggable(LogRecord record)
      Overrides:
      isLoggable in class StreamHandler
    • flush

      public void flush()
      Overrides:
      flush in class StreamHandler
    • roll

      public void roll()
      Explicitly rolls the log file.
    • close

      public void close()
      First stops all dependencies using this handler (changes status to GlassFishLogHandler.GlassFishLogHandlerStatus.OFF, then closes all resources managed by this handler and finally closes the output stream.
      Overrides:
      close in class StreamHandler
    • toString

      public String toString()
      Overrides:
      toString in class Object