You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sm...@apache.org on 2015/05/22 22:28:46 UTC
ambari git commit: Revert "AMBARI-11167. Move alert success logs to
DEBUG level (dlysnichenko)"
Repository: ambari
Updated Branches:
refs/heads/trunk b23582532 -> b75d59727
Revert "AMBARI-11167. Move alert success logs to DEBUG level (dlysnichenko)"
This reverts commit badf77f4557a976730beb5f8ccbdf46417a20655.
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b75d5972
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b75d5972
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b75d5972
Branch: refs/heads/trunk
Commit: b75d59727013a67a6a185ebe1b33f6b6509543e7
Parents: b235825
Author: Sumit Mohanty <sm...@hortonworks.com>
Authored: Fri May 22 13:27:34 2015 -0700
Committer: Sumit Mohanty <sm...@hortonworks.com>
Committed: Fri May 22 13:27:34 2015 -0700
----------------------------------------------------------------------
ambari-agent/conf/unix/logging.conf.sample | 26 --------------
ambari-agent/conf/windows/logging.conf.sample | 26 --------------
ambari-agent/pom.xml | 24 +------------
.../src/main/python/ambari_agent/ActionQueue.py | 7 ++--
.../ambari_agent/AlertSchedulerHandler.py | 12 +++++--
.../python/ambari_agent/ClusterConfiguration.py | 2 +-
.../src/main/python/ambari_agent/Controller.py | 21 +++++------
.../src/main/python/ambari_agent/DataCleaner.py | 8 ++---
.../src/main/python/ambari_agent/Heartbeat.py | 4 +--
.../ambari_agent/HostCheckReportFileHandler.py | 8 ++---
.../src/main/python/ambari_agent/NetUtil.py | 5 +--
.../python/ambari_agent/PingPortListener.py | 5 +--
.../ambari_agent/StackVersionsFileHandler.py | 4 +--
.../python/ambari_agent/alerts/script_alert.py | 2 +-
.../python/ambari_agent/alerts/web_alert.py | 4 +--
.../ambari_agent/apscheduler/scheduler.py | 8 ++---
.../ambari_agent/apscheduler/threadpool.py | 2 +-
.../src/main/python/ambari_agent/hostname.py | 2 +-
.../src/main/python/ambari_agent/main.py | 37 ++++++++------------
.../src/main/python/ambari_agent/security.py | 8 ++---
.../resource_management/core/environment.py | 2 +-
.../python/resource_management/core/logger.py | 4 +--
.../libraries/script/script.py | 2 +-
.../2.0.6/HBASE/test_phoenix_queryserver.py | 2 +-
24 files changed, 77 insertions(+), 148 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/b75d5972/ambari-agent/conf/unix/logging.conf.sample
----------------------------------------------------------------------
diff --git a/ambari-agent/conf/unix/logging.conf.sample b/ambari-agent/conf/unix/logging.conf.sample
deleted file mode 100644
index d1a2d0e..0000000
--- a/ambari-agent/conf/unix/logging.conf.sample
+++ /dev/null
@@ -1,26 +0,0 @@
-[loggers]
-keys=root,Controller
-
-[handlers]
-keys=logfile
-
-[formatters]
-keys=logfileformatter
-
-[logger_root]
-level=WARNING
-handlers=logfile
-
-[logger_Controller]
-level=DEBUG
-handlers=logfile
-qualname=Controller
-
-[formatter_logfileformatter]
-format=%(levelname)s %(asctime)s %(filename)s:%(lineno)d - %(message)s
-
-[handler_logfile]
-class=handlers.RotatingFileHandler
-level=DEBUG
-args=('/var/log/ambari-agent/ambari-agent.log',"a", 10000000, 25)
-formatter=logfileformatter
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/b75d5972/ambari-agent/conf/windows/logging.conf.sample
----------------------------------------------------------------------
diff --git a/ambari-agent/conf/windows/logging.conf.sample b/ambari-agent/conf/windows/logging.conf.sample
deleted file mode 100644
index 69c1e95..0000000
--- a/ambari-agent/conf/windows/logging.conf.sample
+++ /dev/null
@@ -1,26 +0,0 @@
-[loggers]
-keys=root,Controller
-
-[handlers]
-keys=logfile
-
-[formatters]
-keys=logfileformatter
-
-[logger_root]
-level=WARNING
-handlers=logfile
-
-[logger_Controller]
-level=DEBUG
-handlers=logfile
-qualname=Controller
-
-[formatter_logfileformatter]
-format=%(levelname)s %(asctime)s %(filename)s:%(lineno)d - %(message)s
-
-[handler_logfile]
-class=handlers.RotatingFileHandler
-level=DEBUG
-args=('\\var\\log\\ambari-agent\\ambari-agent.log',"a", 10000000, 25)
-formatter=logfileformatter
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/b75d5972/ambari-agent/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-agent/pom.xml b/ambari-agent/pom.xml
index 1cf3b71..b807ba9 100644
--- a/ambari-agent/pom.xml
+++ b/ambari-agent/pom.xml
@@ -248,7 +248,7 @@
<location>conf/unix/ambari-sudo.sh</location>
</source>
</sources>
- </mapping>
+ </mapping>
<mapping>
<directory>${ambari_commons.install.dir}</directory>
<username>root</username>
@@ -306,17 +306,6 @@
</sources>
</mapping>
<mapping>
- <directory>/etc/ambari-agent/conf</directory>
- <filemode>755</filemode>
- <username>root</username>
- <groupname>root</groupname>
- <sources>
- <source>
- <location>conf/unix/logging.conf.sample</location>
- </source>
- </sources>
- </mapping>
- <mapping>
<directory>/usr/sbin</directory>
<filemode>755</filemode>
<username>root</username>
@@ -506,17 +495,6 @@
<filemode>755</filemode>
</mapper>
</data>
- <data>
- <src>conf/unix/logging.conf.sample</src>
- <type>file</type>
- <mapper>
- <type>perm</type>
- <prefix>/etc/ambari-agent/conf</prefix>
- <user>root</user>
- <group>root</group>
- <filemode>755</filemode>
- </mapper>
- </data>
<data>
<src>etc/sudoers.d/ambari-agent</src>
<type>file</type>
http://git-wip-us.apache.org/repos/asf/ambari/blob/b75d5972/ambari-agent/src/main/python/ambari_agent/ActionQueue.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/ActionQueue.py b/ambari-agent/src/main/python/ambari_agent/ActionQueue.py
index bdf8767..59a5720 100644
--- a/ambari-agent/src/main/python/ambari_agent/ActionQueue.py
+++ b/ambari-agent/src/main/python/ambari_agent/ActionQueue.py
@@ -25,6 +25,7 @@ import threading
import pprint
import os
import json
+from random import randint
import time
from AgentException import AgentException
@@ -94,7 +95,7 @@ class ActionQueue(threading.Thread):
self.statusCommandQueue.queue.clear()
for command in commands:
- logger.debug("Adding " + command['commandType'] + " for service " + \
+ logger.info("Adding " + command['commandType'] + " for service " + \
command['serviceName'] + " of cluster " + \
command['clusterName'] + " to the queue.")
self.statusCommandQueue.put(command)
@@ -106,7 +107,7 @@ class ActionQueue(threading.Thread):
if not command.has_key('clusterName'):
command['clusterName'] = 'null'
- logger.debug("Adding " + command['commandType'] + " for role " + \
+ logger.info("Adding " + command['commandType'] + " for role " + \
command['role'] + " for service " + \
command['serviceName'] + " of cluster " + \
command['clusterName'] + " to the queue.")
@@ -229,7 +230,7 @@ class ActionQueue(threading.Thread):
"cluster {cluster}.".format(
commandId = str(commandId), role=command['role'],
cluster=clusterName)
- logger.debug(message)
+ logger.info(message)
taskId = command['taskId']
# Preparing 'IN_PROGRESS' report
http://git-wip-us.apache.org/repos/asf/ambari/blob/b75d5972/ambari-agent/src/main/python/ambari_agent/AlertSchedulerHandler.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/AlertSchedulerHandler.py b/ambari-agent/src/main/python/ambari_agent/AlertSchedulerHandler.py
index 75a4d5e..29807e2 100644
--- a/ambari-agent/src/main/python/ambari_agent/AlertSchedulerHandler.py
+++ b/ambari-agent/src/main/python/ambari_agent/AlertSchedulerHandler.py
@@ -35,7 +35,7 @@ from alerts.port_alert import PortAlert
from alerts.script_alert import ScriptAlert
from alerts.web_alert import WebAlert
-logger = logging.getLogger(__name__)
+logger = logging.getLogger()
class AlertSchedulerHandler():
FILENAME = 'definitions.json'
@@ -364,7 +364,15 @@ def main():
args = list(sys.argv)
del args[0]
-
+ try:
+ logger.setLevel(logging.DEBUG)
+ except TypeError:
+ logger.setLevel(12)
+
+ ch = logging.StreamHandler()
+ ch.setLevel(logger.level)
+ logger.addHandler(ch)
+
ash = AlertSchedulerHandler(args[0], args[1], args[2], False)
ash.start()
http://git-wip-us.apache.org/repos/asf/ambari/blob/b75d5972/ambari-agent/src/main/python/ambari_agent/ClusterConfiguration.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/ClusterConfiguration.py b/ambari-agent/src/main/python/ambari_agent/ClusterConfiguration.py
index a572290..ec2cff7 100644
--- a/ambari-agent/src/main/python/ambari_agent/ClusterConfiguration.py
+++ b/ambari-agent/src/main/python/ambari_agent/ClusterConfiguration.py
@@ -23,7 +23,7 @@ import json
import os
import threading
-logger = logging.getLogger(__name__)
+logger = logging.getLogger()
class ClusterConfiguration():
"""
http://git-wip-us.apache.org/repos/asf/ambari/blob/b75d5972/ambari-agent/src/main/python/ambari_agent/Controller.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/Controller.py b/ambari-agent/src/main/python/ambari_agent/Controller.py
index 014a9dd..1702b44 100644
--- a/ambari-agent/src/main/python/ambari_agent/Controller.py
+++ b/ambari-agent/src/main/python/ambari_agent/Controller.py
@@ -45,7 +45,7 @@ from ambari_agent.ClusterConfiguration import ClusterConfiguration
from ambari_agent.RecoveryManager import RecoveryManager
from ambari_agent.HeartbeatHandlers import HeartbeatStopHandlers, bind_signal_handlers
-logger = logging.getLogger(__name__)
+logger = logging.getLogger()
AGENT_AUTO_RESTART_EXIT_CODE = 77
@@ -122,7 +122,7 @@ class Controller(threading.Thread):
try:
server_ip = socket.gethostbyname(self.hostname)
- logger.debug("Registering with %s (%s) (agent=%s)", self.hostname, server_ip, prettyData)
+ logger.info("Registering with %s (%s) (agent=%s)", self.hostname, server_ip, prettyData)
except socket.error:
logger.warn("Unable to determine the IP address of '%s', agent registration may fail (agent=%s)",
self.hostname, prettyData)
@@ -148,11 +148,11 @@ class Controller(threading.Thread):
return ret
self.responseId = int(ret['responseId'])
- logger.debug("Registration Successful (response id = %s)", self.responseId)
+ logger.info("Registration Successful (response id = %s)", self.responseId)
self.isRegistered = True
if 'statusCommands' in ret.keys():
- logger.debug("Got status commands on registration.")
+ logger.info("Got status commands on registration.")
self.addToStatusQueue(ret['statusCommands'])
else:
self.hasMappedComponents = False
@@ -241,7 +241,7 @@ class Controller(threading.Thread):
serverId = int(response['responseId'])
- logger.debug('Heartbeat response received (id = %s)', serverId)
+ logger.info('Heartbeat response received (id = %s)', serverId)
if 'hasMappedComponents' in response.keys():
self.hasMappedComponents = response['hasMappedComponents'] is not False
@@ -299,7 +299,7 @@ class Controller(threading.Thread):
logger.error("Received the restartAgent command")
self.restartAgent()
else:
- logger.debug("No commands sent from %s", self.serverHostname)
+ logger.info("No commands sent from %s", self.serverHostname)
if retry:
logger.info("Reconnected to %s", self.heartbeatUrl)
@@ -366,12 +366,12 @@ class Controller(threading.Thread):
def registerAndHeartbeat(self):
registerResponse = self.registerWithServer()
message = registerResponse['response']
- logger.debug("Registration response from %s was %s", self.serverHostname, message)
+ logger.info("Registration response from %s was %s", self.serverHostname, message)
if self.isRegistered:
# Clearing command queue to stop executing "stale" commands
# after registration
- logger.debug('Resetting ActionQueue...')
+ logger.info('Resetting ActionQueue...')
self.actionQueue.reset()
# Process callbacks
@@ -403,7 +403,7 @@ class Controller(threading.Thread):
def updateComponents(self, cluster_name):
- logger.debug("Updating components map of cluster " + cluster_name)
+ logger.info("Updating components map of cluster " + cluster_name)
# May throw IOError on server connection error
response = self.sendRequest(self.componentsUrl + cluster_name, None)
@@ -416,7 +416,7 @@ class Controller(threading.Thread):
LiveStatus.CLIENT_COMPONENTS.append({"serviceName": service, "componentName": component})
else:
LiveStatus.COMPONENTS.append({"serviceName": service, "componentName": component})
- logger.debug("Components map updated")
+ logger.info("Components map updated")
logger.debug("LiveStatus.SERVICES" + str(LiveStatus.SERVICES))
logger.debug("LiveStatus.CLIENT_COMPONENTS" + str(LiveStatus.CLIENT_COMPONENTS))
logger.debug("LiveStatus.COMPONENTS" + str(LiveStatus.COMPONENTS))
@@ -424,6 +424,7 @@ class Controller(threading.Thread):
def main(argv=None):
# Allow Ctrl-C
+ logger.setLevel(logging.INFO)
formatter = logging.Formatter("%(asctime)s %(filename)s:%(lineno)d - \
%(message)s")
stream_handler = logging.StreamHandler()
http://git-wip-us.apache.org/repos/asf/ambari/blob/b75d5972/ambari-agent/src/main/python/ambari_agent/DataCleaner.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/DataCleaner.py b/ambari-agent/src/main/python/ambari_agent/DataCleaner.py
index 347bcc3..f756eb4 100644
--- a/ambari-agent/src/main/python/ambari_agent/DataCleaner.py
+++ b/ambari-agent/src/main/python/ambari_agent/DataCleaner.py
@@ -25,7 +25,7 @@ import time
import re
import logging
-logger = logging.getLogger(__name__)
+logger = logging.getLogger()
class DataCleaner(threading.Thread):
COMMAND_FILE_NAMES_PATTERN = 'errors-\d+.txt|output-\d+.txt|site-\d+.pp|structured-out-\d+.json|command-\d+.json'
@@ -36,7 +36,7 @@ class DataCleaner(threading.Thread):
def __init__(self, config):
threading.Thread.__init__(self)
self.daemon = True
- logger.debug('Data cleanup thread started')
+ logger.info('Data cleanup thread started')
self.config = config
self.file_max_age = config.get('agent', 'data_cleanup_max_age', 86400)
@@ -117,9 +117,9 @@ class DataCleaner(threading.Thread):
def run(self):
while not self.stopped:
- logger.debug('Data cleanup started')
+ logger.info('Data cleanup started')
self.cleanup()
- logger.debug('Data cleanup finished')
+ logger.info('Data cleanup finished')
time.sleep(self.cleanup_interval)
http://git-wip-us.apache.org/repos/asf/ambari/blob/b75d5972/ambari-agent/src/main/python/ambari_agent/Heartbeat.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/Heartbeat.py b/ambari-agent/src/main/python/ambari_agent/Heartbeat.py
index bc54862..95305d2 100644
--- a/ambari-agent/src/main/python/ambari_agent/Heartbeat.py
+++ b/ambari-agent/src/main/python/ambari_agent/Heartbeat.py
@@ -29,7 +29,7 @@ from ambari_agent.HostInfo import HostInfo
from ambari_agent.Hardware import Hardware
-logger = logging.getLogger(__name__)
+logger = logging.getLogger()
firstContact = True
class Heartbeat:
@@ -74,7 +74,7 @@ class Heartbeat:
if int(id) == 0:
componentsMapped = False
- logger.debug("Building Heartbeat: {responseId = %s, timestamp = %s, commandsInProgress = %s, componentsMapped = %s}",
+ logger.info("Building Heartbeat: {responseId = %s, timestamp = %s, commandsInProgress = %s, componentsMapped = %s}",
str(id), str(timestamp), repr(commandsInProgress), repr(componentsMapped))
if logger.isEnabledFor(logging.DEBUG):
http://git-wip-us.apache.org/repos/asf/ambari/blob/b75d5972/ambari-agent/src/main/python/ambari_agent/HostCheckReportFileHandler.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/HostCheckReportFileHandler.py b/ambari-agent/src/main/python/ambari_agent/HostCheckReportFileHandler.py
index a4b898d..9c0f1d0 100644
--- a/ambari-agent/src/main/python/ambari_agent/HostCheckReportFileHandler.py
+++ b/ambari-agent/src/main/python/ambari_agent/HostCheckReportFileHandler.py
@@ -25,7 +25,7 @@ import traceback
from AmbariConfig import AmbariConfig
import ConfigParser;
-logger = logging.getLogger(__name__)
+logger = logging.getLogger()
class HostCheckReportFileHandler:
@@ -88,7 +88,7 @@ class HostCheckReportFileHandler:
return
try:
- logger.debug("Host check report at " + self.hostCheckFilePath)
+ logger.info("Host check report at " + self.hostCheckFilePath)
config = ConfigParser.RawConfigParser()
config.add_section('metadata')
config.set('metadata', 'created', str(datetime.datetime.now()))
@@ -138,12 +138,12 @@ class HostCheckReportFileHandler:
def removeFile(self, path):
if os.path.isfile(path):
- logger.debug("Removing old host check file at %s" % path)
+ logger.info("Removing old host check file at %s" % path)
os.remove(path)
def touchFile(self, path):
if not os.path.isfile(path):
- logger.debug("Creating host check file at %s" % path)
+ logger.info("Creating host check file at %s" % path)
open(path, 'w').close()
http://git-wip-us.apache.org/repos/asf/ambari/blob/b75d5972/ambari-agent/src/main/python/ambari_agent/NetUtil.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/NetUtil.py b/ambari-agent/src/main/python/ambari_agent/NetUtil.py
index 405b071..f657140 100644
--- a/ambari-agent/src/main/python/ambari_agent/NetUtil.py
+++ b/ambari-agent/src/main/python/ambari_agent/NetUtil.py
@@ -18,13 +18,14 @@ from urlparse import urlparse
import logging
import httplib
from ssl import SSLError
+import platform
from HeartbeatHandlers import HeartbeatStopHandlers
ERROR_SSL_WRONG_VERSION = "SSLError: Failed to connect. Please check openssl library versions. \n" +\
"Refer to: https://bugzilla.redhat.com/show_bug.cgi?id=1022468 for more details."
LOG_REQUEST_MESSAGE = "GET %s -> %s, body: %s"
-logger = logging.getLogger(__name__)
+logger = logging.getLogger()
class NetUtil:
@@ -56,7 +57,7 @@ class NetUtil:
Additionally returns body of request, if available
"""
- logger.debug("Connecting to " + url)
+ logger.info("Connecting to " + url)
responseBody = ""
try:
http://git-wip-us.apache.org/repos/asf/ambari/blob/b75d5972/ambari-agent/src/main/python/ambari_agent/PingPortListener.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/PingPortListener.py b/ambari-agent/src/main/python/ambari_agent/PingPortListener.py
index be65e2b..e15bdb2 100644
--- a/ambari-agent/src/main/python/ambari_agent/PingPortListener.py
+++ b/ambari-agent/src/main/python/ambari_agent/PingPortListener.py
@@ -20,11 +20,12 @@ limitations under the License.
import sys
import logging
+import AmbariConfig
import threading
import socket
import subprocess
-logger = logging.getLogger(__name__)
+logger = logging.getLogger()
FUSER_CMD = "fuser {0}/tcp 2>/dev/null | awk '{1}'"
PSPF_CMD = "ps -fp {0}"
PORT_IN_USE_MESSAGE = "Could not open port {0} because port already used by another process:\n{1}"
@@ -47,7 +48,7 @@ class PingPortListener(threading.Thread):
self.socket.bind((self.host, self.port))
self.socket.listen(1)
config.set('agent','current_ping_port',str(self.socket.getsockname()[1]))
- logger.debug("Ping port listener started on port: " + str(self.socket.getsockname()[1]))
+ logger.info("Ping port listener started on port: " + str(self.socket.getsockname()[1]))
def run_os_command_in_shell(self, command):
http://git-wip-us.apache.org/repos/asf/ambari/blob/b75d5972/ambari-agent/src/main/python/ambari_agent/StackVersionsFileHandler.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/StackVersionsFileHandler.py b/ambari-agent/src/main/python/ambari_agent/StackVersionsFileHandler.py
index 3b696fc..524755d 100644
--- a/ambari-agent/src/main/python/ambari_agent/StackVersionsFileHandler.py
+++ b/ambari-agent/src/main/python/ambari_agent/StackVersionsFileHandler.py
@@ -24,7 +24,7 @@ import threading
import traceback
import shutil
-logger = logging.getLogger(__name__)
+logger = logging.getLogger()
class StackVersionsFileHandler:
@@ -104,7 +104,7 @@ class StackVersionsFileHandler:
Called to create file when it does not exist
'''
if not os.path.isfile(self.versionsFilePath):
- logger.debug("Creating stacks versions file at %s" % self.versionsFilePath)
+ logger.info("Creating stacks versions file at %s" % self.versionsFilePath)
open(self.versionsFilePath, 'w').close()
http://git-wip-us.apache.org/repos/asf/ambari/blob/b75d5972/ambari-agent/src/main/python/ambari_agent/alerts/script_alert.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/alerts/script_alert.py b/ambari-agent/src/main/python/ambari_agent/alerts/script_alert.py
index 969a01f..b8b4daf 100644
--- a/ambari-agent/src/main/python/ambari_agent/alerts/script_alert.py
+++ b/ambari-agent/src/main/python/ambari_agent/alerts/script_alert.py
@@ -25,7 +25,7 @@ import re
from alerts.base_alert import BaseAlert
from resource_management.core.environment import Environment
-logger = logging.getLogger(__name__)
+logger = logging.getLogger()
class ScriptAlert(BaseAlert):
def __init__(self, alert_meta, alert_source_meta, config):
http://git-wip-us.apache.org/repos/asf/ambari/blob/b75d5972/ambari-agent/src/main/python/ambari_agent/alerts/web_alert.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/alerts/web_alert.py b/ambari-agent/src/main/python/ambari_agent/alerts/web_alert.py
index b95a635..34e25e0 100644
--- a/ambari-agent/src/main/python/ambari_agent/alerts/web_alert.py
+++ b/ambari-agent/src/main/python/ambari_agent/alerts/web_alert.py
@@ -46,7 +46,7 @@ except ImportError:
import md5
_md5 = md5.new
-logger = logging.getLogger(__name__)
+logger = logging.getLogger()
# default timeout
DEFAULT_CONNECTION_TIMEOUT = 5
@@ -284,4 +284,4 @@ class WebAlert(BaseAlert):
if state == self.RESULT_CRITICAL:
return 'Connection failed to {1}'
- return 'HTTP {0} response in {2:.4f} seconds'
+ return 'HTTP {0} response in {2:.4f} seconds'
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/b75d5972/ambari-agent/src/main/python/ambari_agent/apscheduler/scheduler.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/apscheduler/scheduler.py b/ambari-agent/src/main/python/ambari_agent/apscheduler/scheduler.py
index 35460b2..319037a 100644
--- a/ambari-agent/src/main/python/ambari_agent/apscheduler/scheduler.py
+++ b/ambari-agent/src/main/python/ambari_agent/apscheduler/scheduler.py
@@ -259,7 +259,7 @@ class Scheduler(object):
event = JobStoreEvent(EVENT_JOBSTORE_JOB_ADDED, jobstore, job)
self._notify_listeners(event)
- logger.debug('Added job "%s" to job store "%s"', job, jobstore)
+ logger.info('Added job "%s" to job store "%s"', job, jobstore)
# Notify the scheduler about the new job
if wakeup:
@@ -505,7 +505,7 @@ class Scheduler(object):
'reached (%d)', job, job.max_instances)
break
- logger.debug('Running job "%s" (scheduled at %s)', job,
+ logger.info('Running job "%s" (scheduled at %s)', job,
run_time)
try:
@@ -524,7 +524,7 @@ class Scheduler(object):
retval=retval)
self._notify_listeners(event)
- logger.debug('Job "%s" executed successfully', job)
+ logger.info('Job "%s" executed successfully', job)
job.remove_instance()
@@ -571,7 +571,7 @@ class Scheduler(object):
def _main_loop(self):
"""Executes jobs on schedule."""
- logger.debug('Scheduler started')
+ logger.info('Scheduler started')
self._notify_listeners(SchedulerEvent(EVENT_SCHEDULER_START))
self._wakeup.clear()
http://git-wip-us.apache.org/repos/asf/ambari/blob/b75d5972/ambari-agent/src/main/python/ambari_agent/apscheduler/threadpool.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/apscheduler/threadpool.py b/ambari-agent/src/main/python/ambari_agent/apscheduler/threadpool.py
index e1a0e5b..8ec47da 100644
--- a/ambari-agent/src/main/python/ambari_agent/apscheduler/threadpool.py
+++ b/ambari-agent/src/main/python/ambari_agent/apscheduler/threadpool.py
@@ -48,7 +48,7 @@ class ThreadPool(object):
self._shutdown = False
_threadpools.add(ref(self))
- logger.debug('Started thread pool with %d core threads and %s maximum '
+ logger.info('Started thread pool with %d core threads and %s maximum '
'threads', core_threads, max_threads or 'unlimited')
def _adjust_threadcount(self):
http://git-wip-us.apache.org/repos/asf/ambari/blob/b75d5972/ambari-agent/src/main/python/ambari_agent/hostname.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/hostname.py b/ambari-agent/src/main/python/ambari_agent/hostname.py
index 3c2fe72..9c03d98 100644
--- a/ambari-agent/src/main/python/ambari_agent/hostname.py
+++ b/ambari-agent/src/main/python/ambari_agent/hostname.py
@@ -25,7 +25,7 @@ import AmbariConfig
import logging
import traceback
-logger = logging.getLogger(__name__)
+logger = logging.getLogger()
cached_hostname = None
cached_public_hostname = None
http://git-wip-us.apache.org/repos/asf/ambari/blob/b75d5972/ambari-agent/src/main/python/ambari_agent/main.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/main.py b/ambari-agent/src/main/python/ambari_agent/main.py
index 5972717..2eeadca 100644
--- a/ambari-agent/src/main/python/ambari_agent/main.py
+++ b/ambari-agent/src/main/python/ambari_agent/main.py
@@ -19,7 +19,6 @@ limitations under the License.
'''
import logging.handlers
-import logging.config
import signal
from optparse import OptionParser
import sys
@@ -43,7 +42,7 @@ from ambari_commons import shell
import HeartbeatHandlers
from HeartbeatHandlers import bind_signal_handlers
from ambari_commons.constants import AMBARI_SUDO_BINARY
-logger = logging.getLogger(__name__)
+logger = logging.getLogger()
formatstr = "%(levelname)s %(asctime)s %(filename)s:%(lineno)d - %(message)s"
agentPid = os.getpid()
@@ -71,27 +70,19 @@ def setup_logging(verbose):
def update_log_level(config):
# Setting loglevel based on config file
- global logger
- log_cfg_file = os.path.join(os.path.dirname(AmbariConfig.AmbariConfig.getConfigFile()), "logging.conf")
- if os.path.exists(log_cfg_file):
- logging.config.fileConfig(log_cfg_file)
- # create logger
- logger = logging.getLogger(__name__)
- logger.info("Logging configured by " + log_cfg_file)
- else:
- try:
- loglevel = config.get('agent', 'loglevel')
- if loglevel is not None:
- if loglevel == 'DEBUG':
- logging.basicConfig(format=formatstr, level=logging.DEBUG, filename=AmbariConfig.AmbariConfig.getLogFile())
- logger.setLevel(logging.DEBUG)
- logger.info("Newloglevel=logging.DEBUG")
- else:
- logging.basicConfig(format=formatstr, level=logging.INFO, filename=AmbariConfig.AmbariConfig.getLogFile())
- logger.setLevel(logging.INFO)
- logger.debug("Newloglevel=logging.INFO")
- except Exception, err:
- logger.info("Default loglevel=DEBUG")
+ try:
+ loglevel = config.get('agent', 'loglevel')
+ if loglevel is not None:
+ if loglevel == 'DEBUG':
+ logging.basicConfig(format=formatstr, level=logging.DEBUG, filename=AmbariConfig.AmbariConfig.getLogFile())
+ logger.setLevel(logging.DEBUG)
+ logger.info("Newloglevel=logging.DEBUG")
+ else:
+ logging.basicConfig(format=formatstr, level=logging.INFO, filename=AmbariConfig.AmbariConfig.getLogFile())
+ logger.setLevel(logging.INFO)
+ logger.debug("Newloglevel=logging.INFO")
+ except Exception, err:
+ logger.info("Default loglevel=DEBUG")
# ToDo: move that function inside AmbariConfig
http://git-wip-us.apache.org/repos/asf/ambari/blob/b75d5972/ambari-agent/src/main/python/ambari_agent/security.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/security.py b/ambari-agent/src/main/python/ambari_agent/security.py
index ac107ca..ec14921 100644
--- a/ambari-agent/src/main/python/ambari_agent/security.py
+++ b/ambari-agent/src/main/python/ambari_agent/security.py
@@ -29,7 +29,7 @@ import traceback
import hostname
import platform
-logger = logging.getLogger(__name__)
+logger = logging.getLogger()
GEN_AGENT_KEY = 'openssl req -new -newkey rsa:1024 -nodes -keyout "%(keysdir)s'+os.sep+'%(hostname)s.key" '\
'-subj /OU=%(hostname)s/ -out "%(keysdir)s'+os.sep+'%(hostname)s.csr"'
@@ -52,11 +52,11 @@ class VerifiedHTTPSConnection(httplib.HTTPSConnection):
try:
sock = self.create_connection()
self.sock = ssl.wrap_socket(sock, cert_reqs=ssl.CERT_NONE)
- logger.debug('SSL connection established. Two-way SSL authentication is '
+ logger.info('SSL connection established. Two-way SSL authentication is '
'turned off on the server.')
except (ssl.SSLError, AttributeError):
self.two_way_ssl_required = True
- logger.error('Insecure connection to https://' + self.host + ':' + self.port +
+ logger.info('Insecure connection to https://' + self.host + ':' + self.port +
'/ failed. Reconnecting using two-way SSL authentication..')
if self.two_way_ssl_required:
@@ -90,7 +90,7 @@ class VerifiedHTTPSConnection(httplib.HTTPSConnection):
def create_connection(self):
if self.sock:
self.sock.close()
- logger.debug("SSL Connect being called.. connecting to the server")
+ logger.info("SSL Connect being called.. connecting to the server")
sock = socket.create_connection((self.host, self.port), 60)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
if self._tunnel_host:
http://git-wip-us.apache.org/repos/asf/ambari/blob/b75d5972/ambari-common/src/main/python/resource_management/core/environment.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/core/environment.py b/ambari-common/src/main/python/resource_management/core/environment.py
index 907521f..bb54d5f 100644
--- a/ambari-common/src/main/python/resource_management/core/environment.py
+++ b/ambari-common/src/main/python/resource_management/core/environment.py
@@ -48,7 +48,7 @@ class Environment(object):
self.reset(basedir, test_mode, tmp_dir)
if not Logger.logger:
- Logger.initialize_logger(__name__, logging_level)
+ Logger.initialize_logger(logging_level)
def reset(self, basedir, test_mode, tmp_dir):
self.system = System.get_instance()
http://git-wip-us.apache.org/repos/asf/ambari/blob/b75d5972/ambari-common/src/main/python/resource_management/core/logger.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/core/logger.py b/ambari-common/src/main/python/resource_management/core/logger.py
index 74e88e8..eef9bc9 100644
--- a/ambari-common/src/main/python/resource_management/core/logger.py
+++ b/ambari-common/src/main/python/resource_management/core/logger.py
@@ -34,7 +34,7 @@ class Logger:
sensitive_strings = {}
@staticmethod
- def initialize_logger(name='resource_management', logging_level=logging.INFO, format='%(asctime)s - %(message)s'):
+ def initialize_logger(logging_level=logging.INFO, name='resource_management', format='%(asctime)s - %(message)s'):
# set up logging (two separate loggers for stderr and stdout with different loglevels)
logger = logging.getLogger(name)
logger.setLevel(logging_level)
@@ -47,7 +47,7 @@ class Logger:
cherr.setFormatter(formatter)
logger.addHandler(cherr)
logger.addHandler(chout)
-
+
Logger.logger = logger
return logger, chout, cherr
http://git-wip-us.apache.org/repos/asf/ambari/blob/b75d5972/ambari-common/src/main/python/resource_management/libraries/script/script.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/script/script.py b/ambari-common/src/main/python/resource_management/libraries/script/script.py
index 2b1c763..b35f109 100644
--- a/ambari-common/src/main/python/resource_management/libraries/script/script.py
+++ b/ambari-common/src/main/python/resource_management/libraries/script/script.py
@@ -166,7 +166,7 @@ class Script(object):
Sets up logging;
Parses command parameters and executes method relevant to command type
"""
- logger, chout, cherr = Logger.initialize_logger(__name__)
+ logger, chout, cherr = Logger.initialize_logger()
# parse arguments
if len(sys.argv) < 7:
http://git-wip-us.apache.org/repos/asf/ambari/blob/b75d5972/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_phoenix_queryserver.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_phoenix_queryserver.py b/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_phoenix_queryserver.py
index 9ef4a21..5f1d856 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_phoenix_queryserver.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_phoenix_queryserver.py
@@ -121,7 +121,7 @@ class TestPhoenixQueryServer(RMFTestCase):
)
self.assertNoMoreResources()
- @skip("there's nothing to upgrade to yet")
+ @skip("there's nothing to upgrade to yet")
def test_start_default_24(self):
self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/phoenix_queryserver.py",
classname = "PhoenixQueryServer",