![]() |
LTTng control library C API
|

Functions | |
| struct lttng_event_rule * | lttng_event_rule_log4j2_logging_create (void) |
| Creates a default Apache Log4j 2 event rule. | |
| enum lttng_event_rule_status | lttng_event_rule_log4j2_logging_get_filter (const struct lttng_event_rule *rule, const char **filter_expr) |
Sets *filter_expr to the event payload and context filter expression of the Apache Log4j 2 event rule rule. | |
| enum lttng_event_rule_status | lttng_event_rule_log4j2_logging_get_log_level_rule (const struct lttng_event_rule *event_rule, const struct lttng_log_level_rule **log_level_rule) |
Sets *log_level_rule to the instrumentation point log level rule of the Apache Log4j 2 event rule event_rule. | |
| enum lttng_event_rule_status | lttng_event_rule_log4j2_logging_get_name_pattern (const struct lttng_event_rule *rule, const char **pattern) |
Sets *pattern to the event name pattern of the Apache Log4j 2 event rule rule. | |
| enum lttng_event_rule_status | lttng_event_rule_log4j2_logging_set_filter (struct lttng_event_rule *rule, const char *filter_expr) |
Sets the event payload and context filter of the Apache Log4j 2 event rule rule to filter_expr. | |
| enum lttng_event_rule_status | lttng_event_rule_log4j2_logging_set_log_level_rule (struct lttng_event_rule *event_rule, const struct lttng_log_level_rule *log_level_rule) |
Sets the instrumentation point log level rule of the Apache Log4j 2 event rule event_rule to log_level_rule. | |
| enum lttng_event_rule_status | lttng_event_rule_log4j2_logging_set_name_pattern (struct lttng_event_rule *rule, const char *pattern) |
Sets the event name pattern of the Apache Log4j 2 event rule rule to pattern. | |
An Apache Log4j 2 event rule is an event rule with the LTTNG_EVENT_RULE_TYPE_LOG4J2_LOGGING type.
Apache Log4j 2 is a modern, high-performance Java logging framework designed as a successor to Apache log4j 1.x. It provides advanced features like asynchronous logging, filtering, and support for custom log levels, along with flexible output formatting and routing via appenders (console, file, or network, for example). The LTTng-UST project provides an Apache Log4j 2 appender which creates an LTTng event from an emitted Log4j 2 logging statement.
Create an Apache Log4j 2 event rule with lttng_event_rule_log4j2_logging_create().
The specific event rule conditions accessors of an Apache Log4j 2 event rule are:
|
extern |
Creates a default Apache Log4j 2 event rule.
On success, the returned event rule has the following initial conditions:
| Condition | Value | Setter |
|---|---|---|
| Instrumentation point type | LTTNG_EVENT_RULE_TYPE_LOG4J2_LOGGING | Not applicable |
| Event name | Any name | lttng_event_rule_log4j2_logging_set_name_pattern() |
| Instrumentation point log level | Any log level | lttng_event_rule_log4j2_logging_set_log_level_rule() |
| Event payload and context filter | No filter | lttng_event_rule_log4j2_logging_set_filter() |
Apache Log4j 2 event rule on success, or NULL on error.
Destroy the returned event rule with lttng_event_rule_destroy().
|
extern |
Sets *filter_expr to the event payload and context filter expression of the Apache Log4j 2 event rule rule.
See the event payload and context filter condition.
| [in] | rule | Apache Log4j 2 event rule of which to get the event payload and context filter. |
| [out] | filter_expr | On success, this function sets
|
| LTTNG_EVENT_RULE_STATUS_OK | Success. |
| LTTNG_EVENT_RULE_STATUS_UNSET | rule has no event payload and context filter, which corresponds to the filter expression 1. |
| LTTNG_EVENT_RULE_STATUS_INVALID | Unsatisfied precondition. |
rule is not NULL.rule has the type LTTNG_EVENT_RULE_TYPE_LOG4J2_LOGGING.expression is not NULL.
|
extern |
Sets *log_level_rule to the instrumentation point log level rule of the Apache Log4j 2 event rule event_rule.
See the instrumentation point log level condition.
| [in] | event_rule | Apache Log4j 2 event rule of which to get the log level rule. |
| [out] | log_level_rule | On success, this function sets
|
| LTTNG_EVENT_RULE_STATUS_OK | Success. |
| LTTNG_EVENT_RULE_STATUS_UNSET | event_rule has no log level rule. |
| LTTNG_EVENT_RULE_STATUS_INVALID | Unsatisfied precondition. |
event_rule is not NULL.event_rule has the type LTTNG_EVENT_RULE_TYPE_LOG4J2_LOGGING.log_level_rule is not NULL.
|
extern |
Sets *pattern to the event name pattern of the Apache Log4j 2 event rule rule.
See the event name condition.
| [in] | rule | Apache Log4j 2 event rule of which to get the event name pattern. |
| [out] | pattern | On success, this function sets
|
| LTTNG_EVENT_RULE_STATUS_OK | Success. |
| LTTNG_EVENT_RULE_STATUS_UNSET | rule has no event name pattern, which corresponds to the pattern * (any event name). |
| LTTNG_EVENT_RULE_STATUS_INVALID | Unsatisfied precondition. |
rule is not NULL.rule has the type LTTNG_EVENT_RULE_TYPE_LOG4J2_LOGGING.pattern is not NULL.
|
extern |
Sets the event payload and context filter of the Apache Log4j 2 event rule rule to filter_expr.
See the event payload and context filter condition.
| [in] | rule | Apache Log4j 2 event rule of which to set the filter. |
| [in] | filter_expr | Event payload and context filter expression of rule (copied). |
| LTTNG_EVENT_RULE_STATUS_OK | Success. |
| LTTNG_EVENT_RULE_STATUS_INVALID | Unsatisfied precondition. |
rule is not NULL.rule has the type LTTNG_EVENT_RULE_TYPE_LOG4J2_LOGGING.filter_expr is not NULL.filter_expr is a valid filter expression (see the event payload and context filter condition).
|
extern |
Sets the instrumentation point log level rule of the Apache Log4j 2 event rule event_rule to log_level_rule.
See the instrumentation point log level condition.
| [in] | event_rule | Apache Log4j 2 event rule of which to set the log level rule. |
| [in] | log_level_rule | Log level rule of event_rule (copied). |
| LTTNG_EVENT_RULE_STATUS_OK | Success. |
| LTTNG_EVENT_RULE_STATUS_INVALID | Unsatisfied precondition. |
event_rule is not NULL.event_rule has the type LTTNG_EVENT_RULE_TYPE_LOG4J2_LOGGING.log_level_rule is not NULL.
|
extern |
Sets the event name pattern of the Apache Log4j 2 event rule rule to pattern.
See the event name condition.
| [in] | rule | Apache Log4j 2 event rule of which to set the event name pattern. |
| [in] | pattern | New event name pattern of rule (copied). |
| LTTNG_EVENT_RULE_STATUS_OK | Success. |
| LTTNG_EVENT_RULE_STATUS_INVALID | Unsatisfied precondition. |
rule is not NULL.rule has the type LTTNG_EVENT_RULE_TYPE_LOG4J2_LOGGING.pattern is not NULL.pattern is not empty.