def run(self):
        """Run the ZooKeeper instance under a temporary directory.

        Writes ZK log messages to zookeeper.log in the current directory.
        """
        if self.running:
            return
        config_path = os.path.join(self.working_path, "zoo.cfg")
        log_path = os.path.join(self.working_path, "log")
        log4j_path = os.path.join(self.working_path, "log4j.properties")
        data_path = os.path.join(self.working_path, "data")

        # various setup steps
        if not os.path.exists(self.working_path):
            os.mkdir(self.working_path)
        if not os.path.exists(log_path):
            os.mkdir(log_path)
        if not os.path.exists(data_path):
            os.mkdir(data_path)

        with open(config_path, "w") as config:
            config.write("""
tickTime=2000
dataDir=%s
clientPort=%s
maxClientCnxns=0
admin.serverPort=%s
""" % (to_java_compatible_path(data_path),
       self.server_info.client_port,
       self.server_info.admin_port))  # NOQA

        # setup a replicated setup if peers are specified
        if self.peers:
            servers_cfg = []
            for p in chain((self.server_info,), self.peers):
                servers_cfg.append("server.%s=localhost:%s:%s" % (
                    p.server_id, p.leader_port, p.election_port))

            with open(config_path, "a") as config:
                config.write("""
initLimit=4
syncLimit=2
%s
""" % ("\n".join(servers_cfg)))

        # Write server ids into datadir
        with open(os.path.join(data_path, "myid"), "w") as myid_file:
            myid_file.write(str(self.server_info.server_id))

        with open(log4j_path, "w") as log4j:
            log4j.write("""
# DEFAULT: console appender only
log4j.rootLogger=INFO, ROLLINGFILE
log4j.appender.ROLLINGFILE.layout=org.apache.log4j.PatternLayout
log4j.appender.ROLLINGFILE.layout.ConversionPattern=%d{ISO8601} [myid:%X{myid}] - %-5p [%t:%C{1}@%L] - %m%n
log4j.appender.ROLLINGFILE=org.apache.log4j.RollingFileAppender
log4j.appender.ROLLINGFILE.Threshold=DEBUG
log4j.appender.ROLLINGFILE.File=""" + to_java_compatible_path(  # NOQA
                self.working_path + os.sep + "zookeeper.log\n"))

        args = [
            "java",
            "-cp", self.classpath,

            # "-Dlog4j.debug",
            "-Dreadonlymode.enabled=true",
            log_path % "-Dzookeeper.log.dir=%s",
            "-Dzookeeper.root.logger=INFO,CONSOLE",
            "-Dlog4j.configuration=file:%s" % log4j_path,

            # OS X: Prevent java from appearing in menu bar, process dock
            # and from activation of the main workspace on run.
            "-Djava.awt.headless=true",

            "org.apache.zookeeper.server.quorum.QuorumPeerMain",
            config_path,
        ]
        self.process = subprocess.Popen(args=args)
        log.info("Started zookeeper process %s using args %s",
                 self.process.pid, args)
        self._running = True
dataset/ETHPy150Open python-zk/kazoo/kazoo/testing/common.py/ManagedZooKeeper.run/swapped operands of `%`