Closed mmilitzer closed 8 years ago
Actually this is a bug with Sincerity, and I fixed this is in git last week. Also, I locked down the version numbers in the POM for Sincerity Logging so this won't happen again "automatically", because it seems that indeed the log4j projects changes these a lot. If you want a quick fix, you can just override your log4j.js file with the version from git:
Hi Tal,
I updated my dependencies and it pulled in log4j 2.5. Afterwards, my log configuration is not loaded anymore due to exceptions raised in sincerity/log4j.js:
JavaException: com.threecrickets.scripturian.exception.ExecutionException: Can't find method
The problem seems to be that the function prototypes of certain methods have changed (??) in log4j 2.5. Or at least, the calls that are made in sincerity/log4j.js assume different prototypes than what's in the log4j documentation.
In particular, I noticed issues with DefaultRolloverStrategy.createStrategy() (l. 539) and PatternLayout.createLayout() (l. 517).
In the case of DefaultRolloverStrategy.createStrategy(), sincerity/log4j.js is missing the "customActions" and "stopCustomActionsOnError" parameters described in the documentation:
https://logging.apache.org/log4j/2.x/log4j-core/apidocs/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.html#createStrategy(java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String,%20org.apache.logging.log4j.core.appender.rolling.action.Action[],%20boolean,%20org.apache.logging.log4j.core.config.Configuration)
With PatternLayout.createLayout() it's the "patternSelector" param that's missing in sincerity/log4j.js but is defined by the log4j documentation:
https://logging.apache.org/log4j/2.0/log4j-core/apidocs/org/apache/logging/log4j/core/layout/PatternLayout.html#createLayout(java.lang.String,%20org.apache.logging.log4j.core.layout.PatternSelector,%20org.apache.logging.log4j.core.config.Configuration,%20org.apache.logging.log4j.core.pattern.RegexReplacement,%20java.nio.charset.Charset,%20boolean,%20boolean,%20java.lang.String,%20java.lang.String)
When I add the missing params with a dummy "null" value, the "Can't find method" exceptions disappear and everything seems to work again at first glance.
The question is why this did all still work with log4j 2.3. In the documentation it looks like the function prototypes are as documented already for the entire log4j 2.x series...