Hi,
I wanted to share something we found while trying to follow the various instructions in this topic. Everything worked well under 10.5, but on 10.7, the logging would work on our external gateway registration servers, but not on the internal servers. On the internal servers, when starting Integration Server, logging to our own file, and to sag-osgi.log and platform.log would suddenly stop halfway through the boot sequence, and from then on, everything would only go to the wrapper.log file. Even ehcache.log would not write anything.
Last few entries in sag-osgi.log:
2021-12-03 16:01:17,311 INFO [com.w.p.PortalException ] - No registered exception delegate
2021-12-03 16:01:17,330 INFO [tas.TaskCompletionHandlerIS ] - Using system/lwq/dbhome directory for completion queue storage
2021-12-03 16:01:17,352 INFO [tas.TaskCompletionHandlerIS ] - Initialized TaskCompletion Queue
Last entry in ehcache.log:
03.12.21 16:01:08.487 [INFO] | My webMethods Server 10.7.0.0001-0063
After opening a ticket with Software AG, here is what we were told:
I have analyzed the information that you provided.
I found that the main difference between your IS v10.5 master, IS v10.7 proxy, and IS v10.7 master instances is that the effective value of the “log4j.configurationFile” System Property is different. For both the IS v10.5 master and IS v10.7 proxy instances (i.e. the “working” instances), the effective value of this property is pointing to the “log4j2.properties” file. However, with the IS v10.7 master instance (i.e. the “non-working” instance), the effective value of this property is "jar\:file\:/opt2/webmethods/IIS/common/lib/wm-caf-common.jar!/logging_config.xml"
I can see that this property is configured in the IS v10.7 master instance’s custom_wrapper.conf file with the following line:
===
wrapper.java.additional.204=-Dlog4j.configurationFile=“/opt2/webMethods/IIS/profiles/IS_IIS/configuration/logging/log4j2.properties,.tc.custom.log4j2.properties”
===
Unfortunately, this property is being overridden during initialization of the Central User Management utility. This is an intentional change that was made to the CipherUtil class used by MWS/Central User Management. That change happened between v10.5 and v10.7.
Software AG’s suggestion to write the custom code is difficult to do in version 2 of log4j logging facility. In version 1, you could point to your own configuration file using a call to DOMConfigurator.configure. However, in version 2, there is no public function performing this task. The Log4j2 documentation mentions a service, but warns that this is not a publicly exposed service, and that if you use it, your code could break with any updates to log4j2 library.
We also thought of using pub.flow.debugLog in package WmPublic, but that would have logged to the server.log file, which was not ideal.
What we decided to do, until we have a better solution, is to update the file logging_config.xml inside the JAR file /opt2/webMethods/IIS/common/lib/wm-caf-common.jar. We used unzip to extract all the files, made our change in logging_config.xml, and used zip -r to create an updated jar file. We kept a copy of the original jar, as reference, and overwrote the one in IIS/common/lib.
We then restarted Integration server. We now have our logging working, and at the same time, the usual logging in wrapper.log continues as it should so it will not affect Web Methods normal operation.
Until there is a better solution, this is what we will be using.
Maybe in a future version of Web Methods Integration Server and MWS, Software AG will make a change to make the use of log4j2 easier.
Original logging_config.xml file inside wm-caf-common.jar :
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="info">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration>
After our changes :
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
<!-- MyFile is for writing to file myfile.log with a log rotation of 1 day, gziping the file -->
<RollingFile name="MyFile" fileName="mylogdir/myfile.log" filePattern="mylogdir/myfile.log.%d{yyyy-MM-dd}.gz">
<PatternLayout>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %p %c - %msg%n</pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true" />
</Policies>
</RollingFile>
</Appenders>
<Loggers>
<!-- log anything from class Log4j2Tests into the myfile.log file -->
<Logger name="Log4j2Tests" level="debug" additivity="false">
<AppenderRef ref="MyFile" />
</Logger>
<Root level="info">
<AppenderRef ref="Console"/>
<!-- uncomment the following if you also want to log the console messages to myfile.log file -->
<!-- <AppenderRef ref="MyFile"/> -->
</Root>
</Loggers>
</Configuration>
Hopefully this can be useful to someone else using Integration Server 10.7
Please note that we did not use our own version of log4j2 libraries, we simply used whatever version came with Integration Server 10.7.