AppController/djinn.rb
# Sends all of the logs that have been buffered up to the Admin Console for
# viewing in a web UI.
Sends all of the logs that have been buffered up to the Admin Console for
viewing in a web UI.
Sends all of the logs that have been buffered up to the Admin Console for viewing in a web UI .
def flush_log_buffer()
    APPS_LOCK.synchronize {
      loop {
        break if @@logs_buffer.empty?
        encoded_logs = JSON.dump({
          'service_name' => 'appcontroller',
          'host' => my_node.public_ip,
          'logs' => @@logs_buffer.shift(LOGS_PER_BATCH),
        })
        if @options['controller_logs_to_dashboard'].downcase == "true"
          begin
            url = URI.parse("https://#{get_load_balancer_ip()}:" +
              "#{AppDashboard::LISTEN_SSL_PORT}/logs/upload")
            http = Net::HTTP.new(url.host, url.port)
            http.verify_mode = OpenSSL::SSL::VERIFY_NONE
            http.use_ssl = true
            response = http.post(url.path, encoded_logs,
              {'Content-Type'=>'application/json'})
            Djinn.log_debug("Done flushing logs to AppDashboard. " +
              "Response is: #{response.body}.")
          rescue
            Djinn.log_debug("Ignoring exception talking to dashboard.")
          end
        end
      }
    }
  end
def flush_log_buffer ( ) APPS_LOCK . synchronize { loop { break if @@logs_buffer . empty? encoded_logs = JSON . dump ( { 'service_name' => 'appcontroller' , 'host' => my_node . public_ip , 'logs' => @@logs_buffer . shift ( LOGS_PER_BATCH ) , } ) if @options [ 'controller_logs_to_dashboard' ] . downcase == "true" begin url = URI . parse ( "https://#{get_load_balancer_ip()}:" + "#{AppDashboard::LISTEN_SSL_PORT}/logs/upload" ) http = Net :: HTTP . new ( url . host , url . port ) http . verify_mode = OpenSSL :: SSL :: VERIFY_NONE http . use_ssl = true response = http . post ( url . path , encoded_logs , { 'Content-Type' => 'application/json' } ) Djinn . log_debug ( "Done flushing logs to AppDashboard. " + "Response is: #{response.body}." ) rescue Djinn . log_debug ( "Ignoring exception talking to dashboard." ) end end } } end
Sends all of the logs that have been buffered up to the Admin Console for
viewing in a web UI.
Sends all of the logs that have been buffered up to the Admin Console for viewing in a web UI .
# We send logs to dashboard only if controller_logs_to_dashboard # is set to True. This will incur in higher traffic to the # database, depending on the verbosity and the deployment. # Don't crash the AppController because we weren't able to send over # the logs - just continue on.