Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Mellanox] Correct the wrong log identifiers of platform daemons #3596

Merged
merged 1 commit into from
Oct 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
REBOOT_CAUSE_FILE_LENGTH = 1

# Global logger class instance
SYSLOG_IDENTIFIER = "mlnx-chassis-api"
logger = Logger(SYSLOG_IDENTIFIER)
logger = Logger()

# magic code defnition for port number, qsfp port position of each hwsku
# port_position_tuple = (PORT_START, QSFP_PORT_START, PORT_END, PORT_IN_BLOCK, EEPROM_OFFSET)
Expand Down
3 changes: 1 addition & 2 deletions platform/mellanox/mlnx-platform-api/sonic_platform/psu.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
raise ImportError (str(e) + "- required module not found")

# Global logger class instance
SYSLOG_IDENTIFIER = "mlnx-psu-api"
logger = Logger(SYSLOG_IDENTIFIER)
logger = Logger()

psu_list = []

Expand Down
3 changes: 1 addition & 2 deletions platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,7 @@
NVE_MASK = PORT_TYPE_MASK & (PORT_TYPE_NVE << PORT_TYPE_OFFSET)

# Global logger class instance
SYSLOG_IDENTIFIER = "mlnx-sfp"
logger = Logger(SYSLOG_IDENTIFIER)
logger = Logger()

class SFP(SfpBase):
"""Platform-specific SFP class"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
from python_sdk_api.sx_api import *
from sonic_daemon_base.daemon_base import Logger

SYSLOG_IDENTIFIER = "sfp-event"

SDK_SFP_STATE_IN = 0x1
SDK_SFP_STATE_OUT = 0x2
STATUS_PLUGIN = '1'
Expand All @@ -34,7 +32,7 @@

PMPE_PACKET_SIZE = 2000

logger = Logger(SYSLOG_IDENTIFIER)
logger = Logger()

class sfp_event:
''' Listen to plugin/plugout cable events '''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
raise ImportError (str(e) + "- required module not found")

# Global logger class instance
SYSLOG_IDENTIFIER = "mlnx-thermal-api"
logger = Logger(SYSLOG_IDENTIFIER)
logger = Logger()

THERMAL_DEV_CATEGORY_CPU_CORE = "cpu_core"
THERMAL_DEV_CATEGORY_CPU_PACK = "cpu_pack"
Expand Down
7 changes: 5 additions & 2 deletions src/sonic-daemon-base/sonic_daemon_base/daemon_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,12 @@ def db_connect(db):
#

class Logger(object):
def __init__(self, syslog_identifier):
def __init__(self, syslog_identifier = None):
self.syslog = syslog
self.syslog.openlog(ident=syslog_identifier, logoption=self.syslog.LOG_NDELAY, facility=self.syslog.LOG_DAEMON)
if syslog_identifier is None:
self.syslog.openlog()
else:
self.syslog.openlog(ident=syslog_identifier, logoption=self.syslog.LOG_NDELAY, facility=self.syslog.LOG_DAEMON)

def __del__(self):
self.syslog.closelog()
Expand Down