Skip to content

Commit 64ebf0d

Browse files
ppkarwaszvy
andcommitted
Corrections due to #2307 review
Co-authored-by: Volkan Yazıcı <volkan@yazi.ci>
1 parent c624e01 commit 64ebf0d

File tree

8 files changed

+32
-357
lines changed

8 files changed

+32
-357
lines changed

log4j-kit/src/main/java/org/apache/logging/log4j/kit/env/ConfigurablePropertyEnvironment.java

Lines changed: 0 additions & 35 deletions
This file was deleted.

log4j-kit/src/main/java/org/apache/logging/log4j/kit/env/Log4jProperty.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@
3535

3636
/**
3737
* Provides a name for the configuration property.
38-
* <p>
39-
*
40-
* </p>
4138
*/
4239
String name() default "";
4340

log4j-kit/src/main/java/org/apache/logging/log4j/kit/env/PropertySource.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ public interface PropertySource {
2929
/**
3030
* Provides the priority of the property source.
3131
* <p>
32-
* Property sources are ordered according to the natural ordering of their priority. Sources with lower
33-
* numerical value take precedence over those with higher numerical value.
32+
* Sources with higher priority override values from sources with lower priority.
3433
* </p>
3534
*
3635
* @return priority value
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,20 @@
2727
* Should haves a slightly lower priority than global environment variables.
2828
* </p>
2929
*/
30-
public class ContextEnvironmentPropertySource implements PropertySource {
30+
public class ContextualEnvironmentPropertySource implements PropertySource {
3131

32-
private static final int DEFAULT_PRIORITY = 100;
32+
private static final int DEFAULT_PRIORITY = 0;
3333

3434
private final String prefix;
3535
private final int priority;
3636

37-
public ContextEnvironmentPropertySource(final String contextName, final int priorityOffset) {
37+
public ContextualEnvironmentPropertySource(final String contextName) {
38+
this(contextName, DEFAULT_PRIORITY);
39+
}
40+
41+
public ContextualEnvironmentPropertySource(final String contextName, final int priority) {
3842
this.prefix = "log4j2." + contextName + ".";
39-
this.priority = DEFAULT_PRIORITY + priorityOffset;
43+
this.priority = priority;
4044
}
4145

4246
@Override
Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,20 @@
2626
* Should have a slightly lower priority than global system properties.
2727
* </p>
2828
*/
29-
public class ContextPropertiesPropertySource implements PropertySource {
29+
public class ContextualJavaPropsPropertySource implements PropertySource {
3030

31-
private static final int DEFAULT_PRIORITY = 0;
31+
private static final int DEFAULT_PRIORITY = 100;
3232

3333
private final String prefix;
3434
private final int priority;
3535

36-
public ContextPropertiesPropertySource(final String contextName, final int priorityOffset) {
37-
this.prefix = "log4j2." + contextName + ".";
38-
this.priority = DEFAULT_PRIORITY + priorityOffset;
36+
public ContextualJavaPropsPropertySource(final String contextName) {
37+
this(contextName, DEFAULT_PRIORITY);
38+
}
39+
40+
public ContextualJavaPropsPropertySource(final String contextName, final int priority) {
41+
this.prefix = "log4j.contexts." + contextName + ".";
42+
this.priority = priority;
3943
}
4044

4145
@Override

log4j-kit/src/main/java/org/apache/logging/log4j/kit/env/internal/CopyOnWriteNavigableSet.java

Lines changed: 0 additions & 269 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
/**
2222
* An environment implementation that uses a specific classloader to load classes.
2323
*/
24-
public abstract class ClassloaderPropertyEnvironment extends BasicPropertyEnvironment {
24+
public abstract class ClassLoaderPropertyEnvironment extends BasicPropertyEnvironment {
2525

2626
private final ClassLoader loader;
2727

28-
public ClassloaderPropertyEnvironment(final ClassLoader loader, final Logger statusLogger) {
28+
public ClassLoaderPropertyEnvironment(final ClassLoader loader, final Logger statusLogger) {
2929
super(statusLogger);
3030
this.loader = loader;
3131
}

0 commit comments

Comments
 (0)