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]
User = "User space tracing domain"
Kernel = "Linux kernel tracing domain."
- Log4j = "Log4j tracing back-end."
+ Log4j = "Log4j 1.x tracing back-end."
+ Log4j2 = "Log4j 2.x tracing back-end."
JUL = "Java Util Logging tracing back-end."
Python = "Python logging module tracing back-end."
ALL = -2147483648
+@enum.unique
+class Log4j2LogLevel(LogLevel):
+ OFF = 0
+ FATAL = 100
+ ERROR = 200
+ WARN = 300
+ INFO = 400
+ DEBUG = 500
+ TRACE = 600
+ ALL = 2147483647
+
+
@enum.unique
class PythonLogLevel(LogLevel):
CRITICAL = 50
return self._name_pattern_exclusions
+class Log4j2TracepointEventRule(TracepointEventRule):
+ def __init__(
+ self,
+ name_pattern=None, # type: Optional[str]
+ filter_expression=None, # type: Optional[str]
+ log_level_rule=None, # type: Optional[LogLevelRule]
+ name_pattern_exclusions=None, # type: Optional[List[str]]
+ ):
+ TracepointEventRule.__init__(self, name_pattern, filter_expression)
+ self._log_level_rule = log_level_rule # type: Optional[LogLevelRule]
+ self._name_pattern_exclusions = (
+ name_pattern_exclusions
+ ) # type: Optional[List[str]]
+
+ if log_level_rule and not isinstance(log_level_rule.level, Log4j2LogLevel):
+ raise ValueError("Log level rule must use a Log4j2LogLevel as its value")
+
+ def _equals(self, other):
+ # type (Log4jTracepointEventRule) -> bool
+ return (
+ self.log_level_rule == other.log_level_rule
+ and self.name_pattern_exclusions == other.name_pattern_exclusions
+ )
+
+ @property
+ def log_level_rule(self):
+ # type: () -> Optional[LogLevelRule]
+ return self._log_level_rule
+
+ @property
+ def name_pattern_exclusions(self):
+ # type: () -> Optional[List[str]]
+ return self._name_pattern_exclusions
+
+
class JULTracepointEventRule(TracepointEventRule):
def __init__(
self,