Workaround for Exceptions Observed for Log4j 2.0
This section lists workaround for the Log4j 2.0 exceptions observed:
Exception—Exception logs are printed with file location information and special characters. For example question mark (?), as follows:
org.apache.solr.client.solrj.SolrServerException: Server refused connection at: http://xxx.xxxx.com:8085/solr/wblib
at org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:688) ~[xxxxx.jar:?]
at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:266) ~[xxxxx.jar:?]
Most of the Windchill console base utilities may have similar observation in exception log. To hide the [<class location> : <file name>] from the exception log add below arguments while running the utilities:
windchill --javaargs=-Dlog4j2.configurationFile\=log4j.properties <name of the utilities>
For example:
windchill --javaargs=-Dlog4j2.configurationFile\=log4j.properties wt.auth.Authentication
In OOTB Log4j 2 0 library, the PatternLayout class contains the propertyalwaysWriteExceptions=true which appends %xEx conversion pattern at the end of mentioned layout. %xEx conversion pattern is same as %ex pattern that was used in log4j 1.2, but %xEx also includes class packaging information. If you do not require the location and class packaging information in logs, set property alwaysWriteExceptions = false and add %ex in layout pattern explicitly as follows:
appender.stdout.type = Console
appender.stdout.name = stdout
appender.stdout.follow = false
appender.stdout.layout.type = PatternLayout
appender.stdout.layout.alwaysWriteExceptions = false
appender.stdout.layout.pattern = %-5p : %c %X{user} - %m%ex%n
Exception—Missing implementation exception, for example:
wt.method.server - MethodServerMain abort java.lang.AbstractMethodError: Missing implementation of resolved method abstract getLogger()Lorg/apache/logging/log4j/Logger; of interface com.infoengine.SAK.Tasklet.
at com.infoengine.SAK.BasicTasklet.postInvoke(BasicTasklet.java:1497)
at com.infoengine.compiledTasks.file.opt.ptc.kangaroo_220.Windchill.tasks.wt.federation.queryprincipals$2exml.invoke(queryprincipals$2exml.java:105)
Clear the Info*Engine cache and remove the files at <WT_HOME>\tasks\codebase\com\infoengine\compiledTasks\file.
Was this helpful?