Index: appengine/gce-backend/agent/agent.py |
diff --git a/appengine/gce-backend/agent/agent.py b/appengine/gce-backend/agent/agent.py |
index ef52a8d5ae00f3081bb4f31b5eb61f54c710011a..4b21655521512f08912e58a4aa5fe2cd2aecb419 100755 |
--- a/appengine/gce-backend/agent/agent.py |
+++ b/appengine/gce-backend/agent/agent.py |
@@ -342,13 +342,23 @@ class SystemdAgent(Agent): |
AGENT_AUTOSTART_TEMPLATE = os.path.join( |
THIS_DIR, 'machine-provider-agent.service.tmpl') |
AGENT_AUTOSTART_PATH = '/etc/systemd/system/machine-provider-agent.service' |
- LOGS_DIR = '/var/log/messages/machine-provider-agent' |
+ LOGS_DIR = '/var/log/machine-provider-agent' |
REBOOT_CMD = ('/sbin/shutdown', '-r', 'now') |
SWARMING_AUTOSTART_TEMPLATE = os.path.join( |
THIS_DIR, 'swarming-start-bot.service.tmpl') |
SWARMING_AUTOSTART_PATH = '/etc/systemd/system/swarming-start-bot.service' |
SWARMING_BOT_DIR = '/b/s' |
+ def configure_logging(self): |
+ """Sets up the logging.""" |
+ try: |
+ from systemd.journal import JournalHandler |
+ logger = logging.getLogger() |
+ logger.setLevel(logging.DEBUG) |
+ logger.addHandler(JournalHandler()) |
+ except ImportError: |
+ super(Agent, self).configure_logging() |
+ |
def start(self): |
"""Starts the Machine Provider agent.""" |
subprocess.check_call(['systemctl', 'daemon-reload']) |