# File httpd/lib/symbiosis/apache_logger.rb, line 199
  def receive_line(line)
    #
    # Make sure the line is a string
    #
    line = line.to_s

    #
    # Split the line into a domain name, and the rest of the line.  The domain is
    # always the first field.  This is supplied by the REMOTE USER so suitable
    # sanity checks have to be made.
    #
    # This "split" splits the line into two at the first group of spaces.
    #
    # irb(main):030:0> "a  b c".split(" ",2)
    # => ["a", " b   c"]
    #
    domain_name, line_without_domain_name = line.split(" ",2)

    #
    # Set up the filehandle as nil to force us to find it each time.
    #
    filehandle = nil

    #
    # Find our domain.  This finds www and non-www prefixes, and returns nil
    # unless the domain is sane.
    #
    domain = @domain_objects[domain_name]
   
    #
    # Make sure the domain has been found, and the Process UID/GID matches the
    # domain UID/GID, or it is root.
    #
    if domain and [0, domain.uid].include?(Process.uid) and [0, domain.gid].include?(Process.gid)
      #
      # Fetch the log filename
      #
      log_filename = File.expand_path(File.join(domain.log_dir, self.log_filename))

      #
      # Fetch the file handle, or open the logfile, as needed.
      #
      filehandle = self.filehandles.find{|fh| fh.is_a?(File) and fh.path == log_filename}

      #
      # Remove the filehandle from the arry (we'll add it back later)
      #
      self.filehandles.delete(filehandle) 

      #
      # If no filehandle was found, or the filehandle we've found is duff,
      # (re)-open it.
      #
      unless filehandle.is_a?(File) and not filehandle.closed?
        #
        # Make sure we don't open more than 50 file handles.
        #
        if self.filehandles.length >= self.max_filehandles
          other_filehandle = self.filehandles.pop
          other_filehandle.close unless other_filehandle.closed?
        end

        filehandle = open_log(log_filename, {:uid => domain.uid, :gid => domain.gid, :sync => self.sync_io})
      end

    end

    if filehandle.is_a?(File) and not filehandle.closed?
      #
      # Add the filehandle onto our array.
      #
      self.filehandles << filehandle

      #
      # Write the log, but without the domain on the front.
      #
      filehandle.puts(line_without_domain_name)
    else
      warn "#{$0}: No file handle found -- logging to default file for #{domain.inspect}" if $VERBOSE and domain.is_a?(Symbiosis::Domain)

      #
      # Make sure the default filehandle is open.
      #
      if @default_filehandle.nil? or @default_filehandle.closed?
        warn "#{$0}: Opening default log file #{self.default_filename}" if $VERBOSE 
        @default_filehandle = open_log(self.default_filename)
      end

      if @default_filehandle.is_a?(File) and not @default_filehandle.closed?
        #
        # Write the unadulterated line to the default log.
        #
        @default_filehandle.puts(line)
      else 
        STDERR.puts line
      end
    end

  end