lttngctl.TracingDomain.User: "userspace",
lttngctl.TracingDomain.Kernel: "kernel",
lttngctl.TracingDomain.Log4j: "log4j",
+ lttngctl.TracingDomain.Log4j2: "log4j2",
lttngctl.TracingDomain.Python: "python",
lttngctl.TracingDomain.JUL: "jul",
}[domain]
lttngctl.TracingDomain.User: "UST",
lttngctl.TracingDomain.Kernel: "KERNEL",
lttngctl.TracingDomain.Log4j: "LOG4J",
+ lttngctl.TracingDomain.Log4j2: "LOG4J2",
lttngctl.TracingDomain.Python: "PYTHON",
lttngctl.TracingDomain.JUL: "JUL",
}[domain]
lttngctl.Log4jLogLevel.TRACE: "TRACE",
lttngctl.Log4jLogLevel.ALL: "ALL",
}[log_level]
+ elif isinstance(log_level, lttngctl.Log4j2LogLevel):
+ return {
+ lttngctl.Log4j2LogLevel.OFF: "OFF",
+ lttngctl.Log4j2LogLevel.FATAL: "FATAL",
+ lttngctl.Log4j2LogLevel.ERROR: "ERROR",
+ lttngctl.Log4j2LogLevel.WARN: "WARN",
+ lttngctl.Log4j2LogLevel.INFO: "INFO",
+ lttngctl.Log4j2LogLevel.DEBUG: "DEBUG",
+ lttngctl.Log4j2LogLevel.TRACE: "TRACE",
+ lttngctl.Log4j2LogLevel.ALL: "ALL",
+ }[log_level]
elif isinstance(log_level, lttngctl.PythonLogLevel):
return {
lttngctl.PythonLogLevel.CRITICAL: "CRITICAL",
"LOG4J_DEBUG": lttngctl.Log4jLogLevel.DEBUG,
"LOG4J_TRACE": lttngctl.Log4jLogLevel.TRACE,
"LOG4J_ALL": lttngctl.Log4jLogLevel.ALL,
+ "LOG4J2_OFF": lttngctl.Log4j2LogLevel.OFF,
+ "LOG4J2_FATAL": lttngctl.Log4j2LogLevel.FATAL,
+ "LOG4J2_ERROR": lttngctl.Log4j2LogLevel.ERROR,
+ "LOG4J2_WARN": lttngctl.Log4j2LogLevel.WARN,
+ "LOG4J2_INFO": lttngctl.Log4j2LogLevel.INFO,
+ "LOG4J2_DEBUG": lttngctl.Log4j2LogLevel.DEBUG,
+ "LOG4J2_TRACE": lttngctl.Log4j2LogLevel.TRACE,
+ "LOG4J2_ALL": lttngctl.Log4j2LogLevel.ALL,
"PYTHON_CRITICAL": lttngctl.PythonLogLevel.CRITICAL,
"PYTHON_ERROR": lttngctl.PythonLogLevel.ERROR,
"PYTHON_WARNING": lttngctl.PythonLogLevel.WARNING,
def _get_tracepoint_event_rule_class_from_domain_type(domain_type):
- # type: (lttngctl.TracingDomain) -> Type[lttngctl.UserTracepointEventRule] | Type[lttngctl.Log4jTracepointEventRule] | Type[lttngctl.JULTracepointEventRule] | Type[lttngctl.PythonTracepointEventRule] | Type[lttngctl.KernelTracepointEventRule]
+ # type: (lttngctl.TracingDomain) -> Type[lttngctl.UserTracepointEventRule] | Type[lttngctl.Log4jTracepointEventRule] | Type[lttngctl.Log4j2TracepointEventRule] | Type[lttngctl.JULTracepointEventRule] | Type[lttngctl.PythonTracepointEventRule] | Type[lttngctl.KernelTracepointEventRule]
return {
lttngctl.TracingDomain.User: lttngctl.UserTracepointEventRule,
lttngctl.TracingDomain.JUL: lttngctl.JULTracepointEventRule,
lttngctl.TracingDomain.Log4j: lttngctl.Log4jTracepointEventRule,
+ lttngctl.TracingDomain.Log4j2: lttngctl.Log4j2TracepointEventRule,
lttngctl.TracingDomain.Python: lttngctl.PythonTracepointEventRule,
lttngctl.TracingDomain.Kernel: lttngctl.KernelTracepointEventRule,
}[domain_type]
# type: () -> None
self._client._run_cmd("stop '{session_name}'".format(session_name=self.name))
+ def clear(self):
+ # type: () -> None
+ self._client._run_cmd("clear '{session_name}'".format(session_name=self.name))
+
def destroy(self):
# type: () -> None
self._client._run_cmd("destroy '{session_name}'".format(session_name=self.name))
else:
return out.decode("utf-8")
- def create_session(self, name=None, output=None):
- # type: (Optional[str], Optional[lttngctl.SessionOutputLocation]) -> lttngctl.Session
+ def create_session(self, name=None, output=None, live=False):
+ # type: (Optional[str], Optional[lttngctl.SessionOutputLocation], bool) -> lttngctl.Session
name = name if name else lttngctl.Session._generate_name()
if isinstance(output, lttngctl.LocalSessionOutputLocation):
output_option = "--output '{output_path}'".format(output_path=output.path)
+ elif isinstance(output, lttngctl.NetworkSessionOutputLocation):
+ output_option = "--set-url '{}'".format(output.url)
elif output is None:
output_option = "--no-output"
else:
raise TypeError("LTTngClient only supports local or no output")
self._run_cmd(
- "create '{session_name}' {output_option}".format(
- session_name=name, output_option=output_option
+ "create '{session_name}' {output_option} {live_option}".format(
+ session_name=name,
+ output_option=output_option,
+ live_option="--live" if live else "",
)
)
return _Session(self, name, output)