-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Script resolution depends on order of element in config file #3336
Comments
(I am new to open source contribution and trying to understand the code) |
The fix must be done in code. The basic problem is that the resolution of script references is done in constructors or factory methods of script-enabled components. For example in logging-log4j2/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/ScriptFilter.java Lines 148 to 157 in 5496c72
Since the constructors of Log4j components are called in the order the components are declared in the configuration file, something like this will fail: <ScriptFilter>
<ScriptRef ref="GLOBAL_FILTER"/>
</ScriptFilter>
<Scripts>
<ScriptFile name="GLOBAL_FILTER"
language="groovy"
path="global-filter.groovy"/>
</Scripts> will fail, since at the moment |
Ok, I did make the changes as you suggested by using the start() method. What more changes do i need to make now? Do i need to change the testcases or anything? |
Yes, if you want to contribute the fix, you should add some tests. See the PR template for more details. Should I assign the issue to you? |
Yes you can assign it to me, also can you guide me with the test cases changes as the ScriptFilterTest.java seems to be consistent with my code is there any file that i need to look into? |
The resolution of
ScriptRef
elements depends on the order of elements in the configuration file: theScripts
element must appear before anyScriptRef
element.The text was updated successfully, but these errors were encountered: