Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo in LoggerConfig.RootLogger.Builder#withtFilter (#3369) #3372

Open
wants to merge 4 commits into
base: 2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void testSingleFilterInvocation() {
.withLoggerName(FQCN)
.withConfig(configuration)
.withLevel(Level.INFO)
.withFilter(filter)
.setFilter(filter)
.build();
final Appender appender = mock(Appender.class);
when(appender.isStarted()).thenReturn(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,26 @@ void testConfig(final LoggerContext ctx) {
.withConfiguration(config)
.build();
final FileAppender appender = FileAppender.newBuilder()
.withFileName(logFile.toString())
.withAppend(false)
.setName("File")
.setBufferedIo(false)
.setIgnoreExceptions(false)
.withBufferedIo(false)
.setName("File")
.setLayout(layout)
.withAppend(false)
.withFileName(logFile.toString())
.build();
appender.start();
config.addAppender(appender);
final AppenderRef ref = AppenderRef.createAppenderRef("File", null, null);
final AppenderRef[] refs = new AppenderRef[] {ref};

final LoggerConfig loggerConfig = LoggerConfig.createLogger(
false, Level.INFO, "org.apache.logging.log4j", "true", refs, null, config, null);
final LoggerConfig loggerConfig = LoggerConfig.newBuilder()
.withConfig(config)
.withAdditivity(false)
.withIncludeLocation("true")
.withLevel(Level.INFO)
.withLoggerName("org.apache.logging.log4j")
.withRefs(refs)
.build();
loggerConfig.addAppender(appender, null, null);
config.addLogger("org.apache.logging.log4j", loggerConfig);
ctx.updateLoggers();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,16 @@ class LoggerConfigTest {
private static final String FQCN = LoggerConfigTest.class.getName();

private static LoggerConfig createForProperties(final Property[] properties) {
return LoggerConfig.createLogger(
true, Level.INFO, "name", "false", new AppenderRef[0], properties, new NullConfiguration(), null);
return LoggerConfig.newBuilder()
.withConfig(new NullConfiguration())
.withAdditivity(true)
.withLevel(Level.INFO)
.withLoggerName("name")
.withIncludeLocation("false")
.withProperties(properties)
.build();
}

@SuppressWarnings({"deprecation"})
@Test
void testPropertiesWithoutSubstitution() {
assertNull(createForProperties(null).getPropertyList(), "null propertiesList");
Expand Down Expand Up @@ -126,7 +131,7 @@ void testSingleFilterInvocation() {
.withLoggerName(FQCN)
.withConfig(configuration)
.withLevel(Level.INFO)
.withFilter(filter)
.setFilter(filter)
.build();
final Appender appender = mock(Appender.class);
when(appender.isStarted()).thenReturn(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Provides Asynchronous Logger classes and interfaces for low-latency logging.
*/
@Export
@Version("2.24.1")
@Version("2.25.0")
package org.apache.logging.log4j.core.async;

import org.osgi.annotation.bundle.Export;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,15 +214,20 @@ public Filter getFilter() {
}

/**
* @deprecated Use {@link #withFilter(Filter)} instead
* @deprecated Use {@link #setFilter(Filter)} instead
*/
@Deprecated
public B withtFilter(final Filter filter) {
this.filter = filter;
return asBuilder();
return setFilter(filter);
}

/** @deprecated Use {@link #setFilter(Filter)} instead. */
@Deprecated
public B withFilter(final Filter filter) {
return setFilter(filter);
}

public B setFilter(final Filter filter) {
this.filter = filter;
return asBuilder();
}
Expand Down Expand Up @@ -945,7 +950,15 @@ public Filter getFilter() {
return filter;
}

/**
* @deprecated Use {@link #setFilter(Filter)} instead
*/
@Deprecated
public B withtFilter(final Filter filter) {
return setFilter(filter);
}

public B setFilter(final Filter filter) {
this.filter = filter;
return asBuilder();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Configuration of Log4j 2.
*/
@Export
@Version("2.24.1")
@Version("2.25.0")
package org.apache.logging.log4j.core.config;

import org.osgi.annotation.bundle.Export;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Implementation of Log4j 2.
*/
@Export
@Version("2.24.2")
@Version("2.25.0")
package org.apache.logging.log4j.core;

import org.osgi.annotation.bundle.Export;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://logging.apache.org/xml/ns"
xsi:schemaLocation="https://logging.apache.org/xml/ns https://logging.apache.org/xml/ns/log4j-changelog-0.xsd"
type="added">
<issue id="3369" link="https://github.com/apache/logging-log4j2/issues/3369"/>
<description format="asciidoc">
Fixed typo in "LoggerConfig.RootLogger.Builder#withtFilter(...)" method.
Created new corrected 'withFilter()' method and deprecated old method.
</description>
</entry>
Loading