LTTng control library C API
Loading...
Searching...
No Matches
Collaboration diagram for Apache Log4j 2 event rule API:

Functions

struct lttng_event_rulelttng_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.
 

Detailed Description

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:

Condition Setter Getter
Event name lttng_event_rule_log4j2_logging_set_name_pattern() lttng_event_rule_log4j2_logging_get_name_pattern()
Instrumentation point log level lttng_event_rule_log4j2_logging_set_log_level_rule() lttng_event_rule_log4j2_logging_get_log_level_rule()
Event payload and context filter lttng_event_rule_log4j2_logging_set_filter() lttng_event_rule_log4j2_logging_get_filter()
See also

Function Documentation

◆ lttng_event_rule_log4j2_logging_create()

struct lttng_event_rule * lttng_event_rule_log4j2_logging_create ( void  )
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()
Returns

Apache Log4j 2 event rule on success, or NULL on error.

Destroy the returned event rule with lttng_event_rule_destroy().

◆ lttng_event_rule_log4j2_logging_get_filter()

enum lttng_event_rule_status lttng_event_rule_log4j2_logging_get_filter ( const struct lttng_event_rule rule,
const char **  filter_expr 
)
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.

Parameters
[in]ruleApache Log4j 2 event rule of which to get the event payload and context filter.
[out]filter_expr

On success, this function sets *filter_expr to the filter expression of rule.

rule owns *filter_expr.

*filter_expr remains valid until the next function call with rule.

Return values
LTTNG_EVENT_RULE_STATUS_OKSuccess.
LTTNG_EVENT_RULE_STATUS_UNSETrule has no event payload and context filter, which corresponds to the filter expression 1.
LTTNG_EVENT_RULE_STATUS_INVALIDUnsatisfied precondition.
Precondition
See also
lttng_event_rule_log4j2_logging_set_filter() – Set the event payload and context filter of an Apache Log4j 2 event rule.

◆ lttng_event_rule_log4j2_logging_get_log_level_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 
)
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.

Parameters
[in]event_ruleApache Log4j 2 event rule of which to get the log level rule.
[out]log_level_rule

On success, this function sets *log_level_rule to the log level rule of event_rule.

event_rule owns *log_level_rule.

*log_level_rule remains valid until the next function call with event_rule.

Return values
LTTNG_EVENT_RULE_STATUS_OKSuccess.
LTTNG_EVENT_RULE_STATUS_UNSETevent_rule has no log level rule.
LTTNG_EVENT_RULE_STATUS_INVALIDUnsatisfied precondition.
Precondition
See also
lttng_event_rule_log4j2_logging_set_log_level_rule() – Set the log level rule of an Apache Log4j 2 event rule.

◆ lttng_event_rule_log4j2_logging_get_name_pattern()

enum lttng_event_rule_status lttng_event_rule_log4j2_logging_get_name_pattern ( const struct lttng_event_rule rule,
const char **  pattern 
)
extern

Sets *pattern to the event name pattern of the Apache Log4j 2 event rule rule.

See the event name condition.

Parameters
[in]ruleApache Log4j 2 event rule of which to get the event name pattern.
[out]pattern

On success, this function sets *pattern to the event name pattern of rule.

rule owns *pattern.

*pattern remains valid until the next function call with rule.

Return values
LTTNG_EVENT_RULE_STATUS_OKSuccess.
LTTNG_EVENT_RULE_STATUS_UNSETrule has no event name pattern, which corresponds to the pattern * (any event name).
LTTNG_EVENT_RULE_STATUS_INVALIDUnsatisfied precondition.
Precondition
See also
lttng_event_rule_log4j2_logging_set_name_pattern() – Set the event name pattern of an Apache Log4j 2 event rule.

◆ lttng_event_rule_log4j2_logging_set_filter()

enum lttng_event_rule_status lttng_event_rule_log4j2_logging_set_filter ( struct lttng_event_rule rule,
const char *  filter_expr 
)
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.

Parameters
[in]ruleApache Log4j 2 event rule of which to set the filter.
[in]filter_exprEvent payload and context filter expression of rule (copied).
Return values
LTTNG_EVENT_RULE_STATUS_OKSuccess.
LTTNG_EVENT_RULE_STATUS_INVALIDUnsatisfied precondition.
Precondition
See also
lttng_event_rule_log4j2_logging_get_filter() – Get the event payload and context filter of an Apache Log4j 2 event rule.

◆ lttng_event_rule_log4j2_logging_set_log_level_rule()

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 
)
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.

Parameters
[in]event_ruleApache Log4j 2 event rule of which to set the log level rule.
[in]log_level_ruleLog level rule of event_rule (copied).
Return values
LTTNG_EVENT_RULE_STATUS_OKSuccess.
LTTNG_EVENT_RULE_STATUS_INVALIDUnsatisfied precondition.
Precondition
See also
lttng_event_rule_log4j2_logging_get_log_level_rule() – Get the log level rule of an Apache Log4j 2 event rule.

◆ lttng_event_rule_log4j2_logging_set_name_pattern()

enum lttng_event_rule_status lttng_event_rule_log4j2_logging_set_name_pattern ( struct lttng_event_rule rule,
const char *  pattern 
)
extern

Sets the event name pattern of the Apache Log4j 2 event rule rule to pattern.

See the event name condition.

Parameters
[in]ruleApache Log4j 2 event rule of which to set the event name pattern.
[in]patternNew event name pattern of rule (copied).
Return values
LTTNG_EVENT_RULE_STATUS_OKSuccess.
LTTNG_EVENT_RULE_STATUS_INVALIDUnsatisfied precondition.
Precondition
See also
lttng_event_rule_log4j2_logging_get_name_pattern() – Get the event name pattern of an Apache Log4j 2 event rule.