# File lib/logging/appender.rb, line 36
  def initialize( name, opts = {} )
    ::Logging.init unless ::Logging.initialized?

    @name = name.to_s
    @closed = false

    self.layout = opts.getopt(:layout, ::Logging::Layouts::Basic.new)
    self.level = opts.getopt(:level)
    self.encoding = opts.fetch(:encoding, self.encoding)

    @mutex = ReentrantMutex.new

    if opts.getopt(:header, true)
      header = @layout.header

      unless header.nil? || header.empty?
        begin
          write(header)
        rescue StandardError => err
          ::Logging.log_internal(-2) {err}
        end
      end
    end

    ::Logging::Appenders[@name] = self
  end