you can use the following properties to specify different locations for the
lttng-ust-agent-java jars:
- mvn clean verify
- -Dcommon-jar-location=/usr/share/java/lttng-ust-agent-common.jar
- -Djul-jar-location=/usr/share/java/lttng-ust-agent-jul.jar
- -Dlog4j-jar-location=/usr/share/java/lttng-ust-agent-log4j.jar
+ mvn clean verify \
+ -Dcommon-jar-location=/usr/share/java/lttng-ust-agent-common.jar \
+ -Djul-jar-location=/usr/share/java/lttng-ust-agent-jul.jar \
+ -Dlog4j-jar-location=/usr/share/java/lttng-ust-agent-log4j.jar \
+ -Dlog4j2-jar-location=/usr/share/java/lttng-ust-agent-log4j2.jar
To specify a different locations for the JNI .so libraries, you can set the
`-Djava.library.path` property on the JVM:
protected abstract Domain getDomain();
+ protected abstract boolean closeHandlers();
+
protected abstract void sendEventsToLoggers();
/**
public void testTeardown() {
session.close();
- logHandler.close();
+ if (closeHandlers()) {
+ logHandler.close();
+ }
logHandler = null;
/* In case some tests fail or forget to unregister their retrievers */
protected abstract Domain getDomain();
+ protected abstract boolean closeHandlers();
+
protected abstract void sendEventsToLoggers();
/**
public void testTeardown() {
session.close();
- handlerA.close();
- handlerB.close();
- handlerC.close();
+ if (closeHandlers()) {
+ handlerA.close();
+ handlerB.close();
+ handlerC.close();
+ }
handlerA = null;
handlerB = null;
protected abstract Domain getDomain();
+ protected abstract boolean closeHandlers();
+
protected abstract void sendEventsToLoggers();
/**
session2.close();
session3.close();
- handlerA.close();
- handlerB.close();
- handlerC.close();
- handlerD.close();
+ if (closeHandlers()) {
+ handlerA.close();
+ handlerB.close();
+ handlerC.close();
+ handlerD.close();
+ }
handlerA = null;
handlerB = null;
return DOMAIN;
}
+ @Override
+ protected boolean closeHandlers()
+ {
+ return true;
+ }
+
@Override
protected void sendEventsToLoggers() {
JulTestUtils.send10EventsTo(logger);
return DOMAIN;
}
+ @Override
+ protected boolean closeHandlers()
+ {
+ return true;
+ }
+
@Override
protected void sendEventsToLoggers() {
JulTestUtils.send10EventsTo(loggerA);
return DOMAIN;
}
+ @Override
+ protected boolean closeHandlers()
+ {
+ return true;
+ }
+
@Override
protected void sendEventsToLoggers() {
JulTestUtils.send10EventsTo(loggerA);
<artifactId>lttng-ust-java-tests-log4j</artifactId>
<packaging>jar</packaging>
- <name>LTTng-UST Java Agent Log4j API Integration Tests</name>
+ <name>LTTng-UST Java Agent Log4j 1.x API Integration Tests</name>
<dependencies>
<dependency>
return DOMAIN;
}
+ @Override
+ protected boolean closeHandlers()
+ {
+ return true;
+ }
+
@Override
protected void sendEventsToLoggers() {
Log4jTestUtils.send10Events(logger);
return DOMAIN;
}
+ @Override
+ protected boolean closeHandlers()
+ {
+ return true;
+ }
+
@Override
protected void sendEventsToLoggers() {
Log4jTestUtils.send10Events(loggerA);
return DOMAIN;
}
+ @Override
+ protected boolean closeHandlers()
+ {
+ return true;
+ }
+
@Override
protected void sendEventsToLoggers() {
Log4jTestUtils.send10Events(loggerA);
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry combineaccessrules="false" exported="true" kind="src" path="/lttng-ust-java-tests-common"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
+ <attributes>
+ <attribute name="module" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>lttng-ust-java-tests-log4j2</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ </natures>
+</projectDescription>
--- /dev/null
+eclipse.preferences.version=1
+encoding//src/test/java=UTF-8
+encoding/<project>=UTF-8
--- /dev/null
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.autoboxing=warning
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=warning
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.8
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=false
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=120
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=space
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
+org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter
--- /dev/null
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_Spaces
+formatter_settings_version=12
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=false
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_functional_interfaces=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=false
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.insert_inferred_type_arguments=false
+sp_cleanup.make_local_variable_final=true
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=false
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_redundant_type_arguments=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=false
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_anonymous_class_creation=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_lambda=true
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+sp_cleanup.use_type_arguments=false
--- /dev/null
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2022, EfficiOS Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.lttng.ust</groupId>
+ <artifactId>lttng-ust-java-parent</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>lttng-ust-java-tests-log4j2</artifactId>
+ <packaging>jar</packaging>
+
+ <name>LTTng-UST Java Agent Log4j 2.x API Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.lttng.ust.agent</groupId>
+ <artifactId>lttng-ust-agent-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.lttng.ust.agent</groupId>
+ <artifactId>lttng-ust-agent-log4j2</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.lttng.tools</groupId>
+ <artifactId>lttng-tools-java</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.lttng.ust</groupId>
+ <artifactId>lttng-ust-java-tests-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+
+</project>
--- /dev/null
+/*
+ * Copyright (C) 2022, EfficiOS Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+package org.lttng.ust.agent.integration.context;
+
+import java.io.IOException;
+
+import org.apache.logging.log4j.core.Logger;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.lttng.tools.ILttngSession.Domain;
+import org.lttng.ust.agent.ILttngHandler;
+import org.lttng.ust.agent.utils.Log4j2TestContext;
+import org.lttng.ust.agent.utils.Log4j2TestUtils;
+
+/**
+ * Enabled app contexts test for the LTTng-UST Log4j 2.x log handler.
+ */
+public class Log4j2AppContextIT extends AppContextITBase {
+
+ private static final Domain DOMAIN = Domain.LOG4J;
+
+ private Log4j2TestContext testContext;
+ private Logger logger;
+
+ /**
+ * Class setup
+ */
+ @BeforeClass
+ public static void log4j2ClassSetup() {
+ Log4j2TestUtils.testClassSetup();
+ }
+
+ /**
+ * Class cleanup
+ */
+ @AfterClass
+ public static void log4j2ClassCleanup() {
+ Log4j2TestUtils.testClassCleanup();
+ }
+
+ /**
+ * Test setup
+ *
+ * @throws SecurityException
+ * @throws IOException
+ */
+ @Before
+ public void log4j2Setup() throws SecurityException, IOException {
+ testContext = new Log4j2TestContext("log4j2.Log4j2AppContextIT.xml");
+
+ testContext.beforeTest();
+
+ logger = testContext.getLoggerContext().getLogger(EVENT_NAME);
+
+ logHandler = (ILttngHandler) logger.getAppenders().get("Lttng");
+ }
+
+ /**
+ * Test teardown
+ */
+ @After
+ public void log4j2Teardown() {
+ testContext.afterTest();
+ logger = null;
+ }
+
+ @Override
+ protected Domain getDomain() {
+ return DOMAIN;
+ }
+
+ @Override
+ protected boolean closeHandlers()
+ {
+ return false;
+ }
+
+ @Override
+ protected void sendEventsToLoggers() {
+ Log4j2TestUtils.send10Events(logger);
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2022, EfficiOS Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+package org.lttng.ust.agent.integration.context;
+
+
+import org.apache.logging.log4j.core.Logger;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.lttng.tools.ILttngSession.Domain;
+import org.lttng.ust.agent.ILttngHandler;
+import org.lttng.ust.agent.utils.Log4j2TestContext;
+import org.lttng.ust.agent.utils.Log4j2TestUtils;
+
+/**
+ * Implementation of {@link AppContextOrderingITBase} for the log4j API.
+ */
+public class Log4j2AppContextOrderingIT extends AppContextOrderingITBase {
+
+ private Log4j2TestContext testContext;
+ private Logger logger;
+
+ /**
+ * Class setup
+ */
+ @BeforeClass
+ public static void log4j2ClassSetup() {
+ Log4j2TestUtils.testClassSetup();
+ }
+
+ /**
+ * Class cleanup
+ */
+ @AfterClass
+ public static void log4j2ClassCleanup() {
+ Log4j2TestUtils.testClassCleanup();
+ }
+
+ /**
+ * Test teardown
+ */
+ @After
+ public void log4j2Teardown() {
+ logger = null;
+ logHandler = null;
+
+ testContext.afterTest();
+ }
+
+ @Override
+ protected Domain getDomain() {
+ return Domain.LOG4J;
+ }
+
+ @Override
+ protected void registerAgent() {
+ testContext = new Log4j2TestContext("log4j2.Log4j2AppContextOrderingIT.xml");
+
+ testContext.beforeTest();
+
+ logger = testContext.getLoggerContext().getLogger(EVENT_NAME);
+
+ logHandler = (ILttngHandler) logger.getAppenders().get("Lttng");
+ }
+
+ @Override
+ protected void sendEventsToLoggers() {
+ Log4j2TestUtils.send10Events(logger);
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2022, EfficiOS Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+package org.lttng.ust.agent.integration.events;
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.apache.logging.log4j.core.Appender;
+import org.apache.logging.log4j.core.Logger;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.lttng.tools.ILttngSession.Domain;
+import org.lttng.ust.agent.ILttngHandler;
+import org.lttng.ust.agent.log4j2.LttngLogAppender;
+import org.lttng.ust.agent.utils.Log4j2TestContext;
+import org.lttng.ust.agent.utils.Log4j2TestUtils;
+
+/**
+ * Enabled events test for the LTTng-UST Log4j log handler.
+ */
+public class Log4j2EnabledEventsIT extends EnabledEventsITBase {
+
+ private static final String APPENDER_NAME_A = "LttngA";
+ private static final String APPENDER_NAME_B = "LttngB";
+ private static final String APPENDER_NAME_C = "LttngC";
+
+ private static final Domain DOMAIN = Domain.LOG4J;
+
+ private Log4j2TestContext testContext;
+
+ private Logger loggerA;
+ private Logger loggerB;
+ private Logger loggerC;
+ private Logger loggerD;
+
+ /**
+ * Class setup
+ */
+ @BeforeClass
+ public static void log4j2ClassSetup() {
+ Log4j2TestUtils.testClassSetup();
+ }
+
+ /**
+ * Class cleanup
+ */
+ @AfterClass
+ public static void log4j2ClassCleanup() {
+ Log4j2TestUtils.testClassCleanup();
+ }
+
+ /**
+ * Test setup
+ *
+ * @throws SecurityException
+ * @throws IOException
+ */
+ @SuppressWarnings("resource")
+ @Before
+ public void log4j2Setup() throws SecurityException, IOException {
+
+ testContext = new Log4j2TestContext("log4j2.Log4j2EnabledEventsIT.xml");
+
+ testContext.beforeTest();
+
+ loggerA = testContext.getLoggerContext().getLogger(EVENT_NAME_A);
+ loggerB = testContext.getLoggerContext().getLogger(EVENT_NAME_B);
+ loggerC = testContext.getLoggerContext().getLogger(EVENT_NAME_C);
+ loggerD = testContext.getLoggerContext().getLogger(EVENT_NAME_D);
+
+ handlerA = (ILttngHandler) loggerA.getAppenders().get(APPENDER_NAME_A);
+ handlerB = (ILttngHandler) loggerB.getAppenders().get(APPENDER_NAME_B);
+ handlerC = (ILttngHandler) loggerC.getAppenders().get(APPENDER_NAME_C);
+ }
+
+ /**
+ * Test teardown
+ */
+ @After
+ public void log4j2Teardown() {
+ loggerA = null;
+ loggerB = null;
+ loggerC = null;
+ loggerD = null;
+
+ testContext.afterTest();
+ }
+
+ @Override
+ protected Domain getDomain() {
+ return DOMAIN;
+ }
+
+ @Override
+ protected boolean closeHandlers()
+ {
+ return false;
+ }
+
+ @Override
+ protected void sendEventsToLoggers() {
+ Log4j2TestUtils.send10Events(loggerA);
+ Log4j2TestUtils.send10Events(loggerB);
+ Log4j2TestUtils.send10Events(loggerC);
+ Log4j2TestUtils.send10Events(loggerD);
+ }
+
+ @Override
+ protected void sendLocalizedEvent(String rawString, Object[] params) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ @Test
+ public void testLocalizedMessage() {
+ /* Does not apply to log4j 1.2.x */
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2022, EfficiOS Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+package org.lttng.ust.agent.integration.events;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.logging.log4j.Logger;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestName;
+import org.lttng.tools.ILttngSession;
+import org.lttng.ust.agent.utils.Log4j2TestContext;
+import org.lttng.ust.agent.utils.Log4j2TestUtils;
+
+/**
+ * Test suite for the list events command for the log4j domain
+ */
+public class Log4j2ListEventsIT {
+
+ protected static final String LOGGER_NAME_1 = "org.lttng.somecomponent";
+ protected static final String LOGGER_NAME_2 = "org.lttng.mycomponent";
+ protected static final String LOGGER_NAME_3 = "org.lttng.myothercomponent-àéç";
+
+ private Logger logger1;
+ private Logger logger2;
+ private Logger logger3;
+
+ private ILttngSession session;
+ private Log4j2TestContext testContext;
+
+ @Rule
+ public TestName testName = new TestName();
+
+ /**
+ * Class setup
+ */
+ @BeforeClass
+ public static void log4j2ClassSetup() {
+ Log4j2TestUtils.testClassSetup();
+ }
+
+ /**
+ * Class cleanup
+ */
+ @AfterClass
+ public static void log4j2ClassCleanup() {
+ Log4j2TestUtils.testClassCleanup();
+ }
+
+ /**
+ * Create a new session before each test.
+ */
+ @Before
+ public void testSetup() {
+ session = ILttngSession.createSession("Log4j2ListEventsIT", ILttngSession.Domain.LOG4J);
+
+ testContext = new Log4j2TestContext("log4j2." + testName.getMethodName() + ".xml");
+
+ testContext.beforeTest();
+
+ logger1 = testContext.getLoggerContext().getLogger(LOGGER_NAME_1);
+ logger2 = testContext.getLoggerContext().getLogger(LOGGER_NAME_2);
+ logger3 = testContext.getLoggerContext().getLogger(LOGGER_NAME_3);
+ }
+
+ /**
+ * Close the current session after each test.
+ */
+ @After
+ public void testTeardown() {
+ session.close();
+ testContext.afterTest();
+ }
+
+ /**
+ * Test with many loggers existing, but none of them having a LTTng handler
+ * attached.
+ */
+ @Test
+ public void testManyLoggersNoneAttached() {
+
+ /* Don't attach anything */
+ List<String> actualEvents = session.listEvents();
+ assertTrue(actualEvents.isEmpty());
+ }
+
+ /**
+ * Test with many loggers existing, but only a subset of them has a LTTng
+ * handler attached.
+ */
+ @Test
+ public void testManyLoggersSomeAttached() {
+
+ List<String> expectedEvents = Arrays.asList(LOGGER_NAME_1);
+ List<String> actualEvents = session.listEvents();
+
+ Collections.sort(expectedEvents);
+ Collections.sort(actualEvents);
+
+ assertEquals(expectedEvents, actualEvents);
+ }
+
+ /**
+ * Test with many loggers existing, and all of them having a LTTng handler
+ * attached.
+ */
+ @Test
+ public void testManyLoggersAllAttached() {
+
+ List<String> expectedEvents = Arrays.asList(LOGGER_NAME_1, LOGGER_NAME_2, LOGGER_NAME_3);
+ List<String> actualEvents = session.listEvents();
+
+ Collections.sort(expectedEvents);
+ Collections.sort(actualEvents);
+
+ assertEquals(expectedEvents, actualEvents);
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2022, EfficiOS Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+package org.lttng.ust.agent.integration.events;
+
+import java.io.IOException;
+
+import org.apache.logging.log4j.core.Logger;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.lttng.tools.ILttngSession.Domain;
+import org.lttng.ust.agent.ILttngHandler;
+import org.lttng.ust.agent.utils.Log4j2TestContext;
+import org.lttng.ust.agent.utils.Log4j2TestUtils;
+
+/**
+ * Log4j tests for multiple concurrent tracing sessions
+ */
+public class Log4j2MultiSessionIT extends MultiSessionITBase {
+
+ private static final String APPENDER_NAME_A = "LttngA";
+ private static final String APPENDER_NAME_B = "LttngB";
+ private static final String APPENDER_NAME_C = "LttngC";
+ private static final String APPENDER_NAME_D = "LttngD";
+
+ private static final Domain DOMAIN = Domain.LOG4J;
+
+ private Log4j2TestContext testContext;
+
+ private Logger loggerA;
+ private Logger loggerB;
+ private Logger loggerC;
+ private Logger loggerD;
+
+ /**
+ * Class setup
+ */
+ @BeforeClass
+ public static void log4j2ClassSetup() {
+ Log4j2TestUtils.testClassSetup();
+ }
+
+ /**
+ * Class cleanup
+ */
+ @AfterClass
+ public static void log4j2ClassCleanup() {
+ Log4j2TestUtils.testClassCleanup();
+ }
+
+ /**
+ * Test setup
+ *
+ * @throws SecurityException
+ * @throws IOException
+ */
+ @Before
+ public void log4j2Setup() throws SecurityException, IOException {
+
+ testContext = new Log4j2TestContext("log4j2.Log4j2MultiSessionIT.xml");
+
+ testContext.beforeTest();
+
+ loggerA = testContext.getLoggerContext().getLogger(EVENT_NAME_A);
+ loggerB = testContext.getLoggerContext().getLogger(EVENT_NAME_B);
+ loggerC = testContext.getLoggerContext().getLogger(EVENT_NAME_C);
+ loggerD = testContext.getLoggerContext().getLogger(EVENT_NAME_D);
+
+ handlerA = (ILttngHandler) loggerA.getAppenders().get(APPENDER_NAME_A);
+ handlerB = (ILttngHandler) loggerB.getAppenders().get(APPENDER_NAME_B);
+ handlerC = (ILttngHandler) loggerC.getAppenders().get(APPENDER_NAME_C);
+ handlerD = (ILttngHandler) loggerD.getAppenders().get(APPENDER_NAME_D);
+ }
+
+ /**
+ * Test teardown
+ */
+ @After
+ public void log4j2Teardown() {
+ loggerA = null;
+ loggerB = null;
+ loggerC = null;
+ loggerD = null;
+
+ testContext.afterTest();
+ }
+
+ @Override
+ protected Domain getDomain() {
+ return DOMAIN;
+ }
+
+ @Override
+ protected boolean closeHandlers()
+ {
+ return false;
+ }
+
+ @Override
+ protected void sendEventsToLoggers() {
+ Log4j2TestUtils.send10Events(loggerA);
+ Log4j2TestUtils.send10Events(loggerB);
+ Log4j2TestUtils.send10Events(loggerC);
+ Log4j2TestUtils.send10Events(loggerD);
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2022, EfficiOS Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+package org.lttng.ust.agent.integration.filter;
+
+import java.io.IOException;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.lttng.tools.ILttngSession;
+import org.lttng.ust.agent.ILttngHandler;
+import org.lttng.ust.agent.log4j2.LttngLogAppender;
+import org.lttng.ust.agent.utils.ILogLevelStrings;
+import org.lttng.ust.agent.utils.Log4j2TestUtils;
+
+/**
+ * Filter notifications tests using the log4j logging API.
+ *
+ * @author Alexandre Montplaisir
+ */
+public class Log4j2FilterListenerIT extends FilterListenerITBase {
+
+ /**
+ * Class setup
+ */
+ @BeforeClass
+ public static void log4j2ClassSetup() {
+ Log4j2TestUtils.testClassSetup();
+ }
+
+ /**
+ * Class cleanup
+ */
+ @AfterClass
+ public static void log4j2ClassCleanup() {
+ Log4j2TestUtils.testClassCleanup();
+ }
+
+ @Override
+ protected ILttngSession.Domain getSessionDomain() {
+ return ILttngSession.Domain.LOG4J;
+ }
+
+ @Override
+ protected ILttngHandler getLogHandler() throws SecurityException, IOException {
+ return LttngLogAppender.createAppender("Log4j2FilterListenerIT", null, null);
+ }
+
+ @Override
+ protected ILogLevelStrings getLogLevelStrings() {
+ return ILogLevelStrings.LOG4J_LOGLEVEL_STRINGS;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2022, EfficiOS Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+package org.lttng.ust.agent.integration.filter;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.lttng.tools.ILttngSession.Domain;
+import org.lttng.ust.agent.utils.Log4j2TestContext;
+import org.lttng.ust.agent.utils.Log4j2TestUtils;
+
+/**
+ * Implementation of {@link FilterListenerOrderingITBase} for the log4j API.
+ */
+public class Log4j2FilterListenerOrderingIT extends FilterListenerOrderingITBase {
+
+ private Log4j2TestContext testContext;
+
+ /**
+ * Class setup
+ */
+ @BeforeClass
+ public static void log4j2ClassSetup() {
+ Log4j2TestUtils.testClassSetup();
+ }
+
+ /**
+ * Class cleanup
+ */
+ @AfterClass
+ public static void log4j2ClassCleanup() {
+ Log4j2TestUtils.testClassCleanup();
+ }
+
+ @Override
+ protected Domain getDomain() {
+ return Domain.LOG4J;
+ }
+
+ @Override
+ protected void registerAgent() {
+ testContext = new Log4j2TestContext("log4j2.Log4j2FilterListenerOrderingIT.xml");
+ testContext.beforeTest();
+ }
+
+ @Override
+ protected void deregisterAgent() {
+ testContext.afterTest();
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2022, EfficiOS Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+package org.lttng.ust.agent.utils;
+
+import java.net.URI;
+import java.net.URL;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.core.LoggerContext;
+
+public class Log4j2TestContext {
+
+ private final URI configFileUri;
+
+ private LoggerContext loggerContext;
+
+ public Log4j2TestContext(String configFile) {
+
+ URL resource = getClass().getClassLoader().getResource(configFile);
+
+ if (resource == null) {
+ throw new IllegalArgumentException("Config file not found: " + configFile);
+ }
+
+ try {
+ this.configFileUri = resource.toURI();
+ } catch (Exception e) {
+ throw new IllegalArgumentException("Config file invalid URI: " + resource);
+ }
+ }
+
+ public synchronized LoggerContext getLoggerContext() {
+ return loggerContext;
+ }
+
+ public synchronized void beforeTest() {
+ loggerContext = (LoggerContext) LogManager.getContext(
+ ClassLoader.getSystemClassLoader(), false, configFileUri);
+ }
+
+ public synchronized void afterTest() {
+ loggerContext.stop();
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2022, EfficiOS Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+package org.lttng.ust.agent.utils;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.Logger;
+import org.lttng.tools.ILttngSession.Domain;
+import org.lttng.tools.LttngToolsHelper;
+import org.lttng.ust.agent.log4j2.LttngLogAppender;
+
+
+/**
+ * Utility methods for log4j 2.x tests
+ */
+public final class Log4j2TestUtils {
+
+ private Log4j2TestUtils() {
+ }
+
+ /**
+ * Setup method common to most log4j tests. To be called in a @BeforeClass.
+ */
+ public static void testClassSetup() {
+ /* Make sure we can find the JNI library and lttng-tools */
+ checkForLog4jLibrary();
+ assertTrue("lttng-tools is not working properly.", LttngUtils.checkForLttngTools(Domain.LOG4J));
+
+ LttngToolsHelper.destroyAllSessions();
+ }
+
+ /**
+ * Teardown method common to most log4j tests. To be called in a @AfterClass.
+ */
+ public static void testClassCleanup() {
+ LttngToolsHelper.deleteAllTraces();
+ }
+
+ /**
+ * Check the the Log4j native library is available, effectively allowing
+ * LTTng Log4j appenders to be used.
+ */
+ private static void checkForLog4jLibrary() {
+ try {
+ LttngLogAppender testAppender = LttngLogAppender.createAppender("checkForLttngTools", null, null);
+ testAppender.close();
+ } catch (SecurityException | IOException e) {
+ fail(e.getMessage());
+ }
+ }
+
+ /**
+ * Send 10 dummy events through the provided logger
+ *
+ * @param logger
+ * The logger to use to send events
+ */
+ public static void send10Events(Logger logger) {
+ // Levels/priorities are DEBUG, ERROR, FATAL, INFO, TRACE, WARN
+ logger.debug("Debug message. Lost among so many.");
+ logger.debug("Debug message with a throwable", new IOException());
+ logger.error("Error messsage. This might be bad.");
+ logger.error("Error message with a throwable", new IOException());
+ logger.fatal("A fatal message. You are already dead.");
+ logger.info("A info message. Lol, who cares.");
+ logger.trace("A trace message. No, no *that* trace");
+ logger.warn("A warn message. Yellow underline.");
+ logger.log(Level.DEBUG, "A debug message using .log()");
+ logger.log(Level.ERROR, "A error message using .log()");
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Configuration name="Log4j2AppContextIT" status="debug">
+ <Appenders>
+ <Console name="Console" target="SYSTEM_OUT">
+ <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
+ </Console>
+ <Lttng name="Lttng"/>
+ </Appenders>
+ <Loggers>
+ <Logger name="EventName">
+ <AppenderRef ref="Console"/>
+ <AppenderRef ref="Lttng"/>
+ </Logger>
+ <Root level="all"/>
+ </Loggers>
+</Configuration>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Configuration name="Log4j2AppContextOrderingIT" status="debug">
+ <Appenders>
+ <Console name="Console" target="SYSTEM_OUT">
+ <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
+ </Console>
+ <Lttng name="Lttng"/>
+ </Appenders>
+ <Loggers>
+ <Logger name="EventName">
+ <AppenderRef ref="Console"/>
+ <AppenderRef ref="Lttng"/>
+ </Logger>
+ <Root level="all"/>
+ </Loggers>
+</Configuration>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Configuration name="Log4j2ListEventsIT" status="debug">
+ <Appenders>
+ <Console name="Console" target="SYSTEM_OUT">
+ <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
+ </Console>
+ <Lttng name="LttngA"/>
+ <Lttng name="LttngB"/>
+ <Lttng name="LttngC"/>
+ </Appenders>
+ <Loggers>
+ <Logger name="EventA">
+ <AppenderRef ref="Console"/>
+ <AppenderRef ref="LttngA"/>
+ </Logger>
+ <Logger name="EventAB">
+ <AppenderRef ref="Console"/>
+ <AppenderRef ref="LttngB"/>
+ </Logger>
+ <Logger name="EventABC">
+ <AppenderRef ref="Console"/>
+ <AppenderRef ref="LttngC"/>
+ </Logger>
+ <Logger name="EventABCDÉ">
+ <AppenderRef ref="Console"/>
+ </Logger>
+ <Root level="all"/>
+ </Loggers>
+</Configuration>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Configuration name="Log4j2FilterListenerOrderingIT" status="debug">
+ <Appenders>
+ <Console name="Console" target="SYSTEM_OUT">
+ <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
+ </Console>
+ <Lttng name="Lttng"/>
+ </Appenders>
+ <Loggers>
+ <Logger name="EventA">
+ <AppenderRef ref="Console"/>
+ <AppenderRef ref="Lttng"/>
+ </Logger>
+ <Logger name="EventB">
+ <AppenderRef ref="Console"/>
+ <AppenderRef ref="Lttng"/>
+ </Logger>
+ <Root level="all"/>
+ </Loggers>
+</Configuration>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Configuration name="Log4j2MultiSessionIT" status="debug">
+ <Appenders>
+ <Console name="Console" target="SYSTEM_OUT">
+ <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
+ </Console>
+ <Lttng name="LttngA"/>
+ <Lttng name="LttngB"/>
+ <Lttng name="LttngC"/>
+ <Lttng name="LttngD"/>
+ </Appenders>
+ <Loggers>
+ <Logger name="EventA">
+ <AppenderRef ref="Console"/>
+ <AppenderRef ref="LttngA"/>
+ </Logger>
+ <Logger name="EventAB">
+ <AppenderRef ref="Console"/>
+ <AppenderRef ref="LttngB"/>
+ </Logger>
+ <Logger name="EventABC">
+ <AppenderRef ref="Console"/>
+ <AppenderRef ref="LttngC"/>
+ </Logger>
+ <Logger name="EventABCDÉ">
+ <AppenderRef ref="Console"/>
+ <AppenderRef ref="LttngD"/>
+ </Logger>
+ <Root level="all"/>
+ </Loggers>
+</Configuration>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Configuration name="ManyLoggersAllAttached" status="debug">
+ <Appenders>
+ <Console name="Console" target="SYSTEM_OUT">
+ <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
+ </Console>
+ <Lttng name="Lttng1"/>
+ <Lttng name="Lttng2"/>
+ <Lttng name="Lttng3"/>
+ </Appenders>
+ <Loggers>
+ <Logger name="org.lttng.somecomponent">
+ <AppenderRef ref="Console"/>
+ <AppenderRef ref="Lttng1"/>
+ </Logger>
+ <Logger name="org.lttng.mycomponent">
+ <AppenderRef ref="Console"/>
+ <AppenderRef ref="Lttng2"/>
+ </Logger>
+ <Logger name="org.lttng.myothercomponent-àéç">
+ <AppenderRef ref="Console"/>
+ <AppenderRef ref="Lttng3"/>
+ </Logger>
+ <Root level="all"/>
+ </Loggers>
+</Configuration>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Configuration name="ManyLoggersNoneAttached" status="debug">
+ <Appenders>
+ <Console name="Console" target="SYSTEM_OUT">
+ <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
+ </Console>
+ <Lttng name="Lttng1"/>
+ <Lttng name="Lttng2"/>
+ <Lttng name="Lttng3"/>
+ </Appenders>
+ <Loggers>
+ <Logger name="org.lttng.somecomponent">
+ <AppenderRef ref="Console"/>
+ </Logger>
+ <Logger name="org.lttng.mycomponent">
+ <AppenderRef ref="Console"/>
+ </Logger>
+ <Logger name="org.lttng.myothercomponent-àéç">
+ <AppenderRef ref="Console"/>
+ </Logger>
+ <Root level="all"/>
+ </Loggers>
+</Configuration>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Configuration name="ManyLoggersSomeAttached" status="debug">
+ <Appenders>
+ <Console name="Console" target="SYSTEM_OUT">
+ <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
+ </Console>
+ <Lttng name="Lttng1"/>
+ <Lttng name="Lttng2"/>
+ <Lttng name="Lttng3"/>
+ </Appenders>
+ <Loggers>
+ <Logger name="org.lttng.somecomponent">
+ <AppenderRef ref="Console"/>
+ <AppenderRef ref="Lttng1"/>
+ </Logger>
+ <Logger name="org.lttng.mycomponent">
+ <AppenderRef ref="Console"/>
+ </Logger>
+ <Logger name="org.lttng.myothercomponent-àéç">
+ <AppenderRef ref="Console"/>
+ </Logger>
+ <Root level="all"/>
+ </Loggers>
+</Configuration>
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; only
version 2.1 of the License.
-
+
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
-
+
<!-- Paths that come from UST's default "make install".
Override to specify other locations. -->
<common-jar-location>/usr/local/share/java/lttng-ust-agent-common-1.0.0.jar</common-jar-location>
<jul-jar-location>/usr/local/share/java/lttng-ust-agent-jul-1.0.0.jar</jul-jar-location>
<log4j-jar-location>/usr/local/share/java/lttng-ust-agent-log4j-1.0.0.jar</log4j-jar-location>
+ <log4j2-jar-location>/usr/local/share/java/lttng-ust-agent-log4j2-1.0.0.jar</log4j2-jar-location>
<argLine>-Djava.library.path=/usr/local/lib</argLine>
</properties>
<version>1.2.17</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-api</artifactId>
+ <version>2.17.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
+ <version>2.17.1</version>
+ </dependency>
+
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<systemPath>${log4j-jar-location}</systemPath>
</dependency>
+ <dependency>
+ <groupId>org.lttng.ust.agent</groupId>
+ <artifactId>lttng-ust-agent-log4j2</artifactId>
+ <version>1.0.0</version>
+ <scope>system</scope>
+ <systemPath>${log4j2-jar-location}</systemPath>
+ </dependency>
+
<!-- Provided by this project -->
<dependency>
<groupId>org.lttng.tools</groupId>
<module>lttng-ust-java-tests-common</module>
<module>lttng-ust-java-tests-jul</module>
<module>lttng-ust-java-tests-log4j</module>
+ <module>lttng-ust-java-tests-log4j2</module>
</modules>
</project>