import logging

import salt.config
from tests.support.helpers import PRE_PYTEST_SKIP

# Using the PRE_PYTEST_SKIP decorator since this test still fails on some platforms.
# Will investigate later.


@PRE_PYTEST_SKIP
def test_jid_in_logs(caplog, salt_call_cli):
    """
    Test JID in log_format
    """
    jid_formatted_str = salt.config._DFLT_LOG_FMT_JID.split("%")[0]
    formatter = logging.Formatter(fmt="%(jid)s %(message)s")
    with caplog.at_level(logging.DEBUG):
        previous_formatter = caplog.handler.formatter
        try:
            caplog.handler.setFormatter(formatter)
            ret = salt_call_cli.run("test.ping")
            assert ret.returncode == 0
            assert ret.data is True

            assert_error_msg = (
                "'{}' not found in log messages:\n>>>>>>>>>{}\n<<<<<<<<<".format(
                    jid_formatted_str, caplog.text
                )
            )
            assert jid_formatted_str in caplog.text, assert_error_msg
        finally:
            caplog.handler.setFormatter(previous_formatter)

@@ -13,26 +13,50 @@
 ng%0A%0A
-import salt.config
+from salt._logging import DFLT_LOG_FMT_JID
 %0Afro
@@ -349,21 +349,8 @@
 r = 
-salt.config._
 DFLT

Fix AttributeError: module 'salt.config' has no attribute '_DFLT_LOG_FMT_JID'