Hi,
I am trying to use logback as the logging framework for my flow services. I have created a JAVA service for this.
But I am unable to see the log file created by the service.
IDataCursor pipelineCursor = pipeline.getCursor();
String logbackXML = IDataUtil.getString( pipelineCursor, "logbackXML" );
String logfileName = IDataUtil.getString( pipelineCursor, "logFile" );
System.setProperty("logback.configurationFile", logbackXML);
System.setProperty("logfilePath", logfileName);
Logger log = LoggerFactory.getLogger("ROOT");
log.info("------------into the info logger--------------");
Same code snippet is working fine when I called from a stand alone Java class, but the same not generating the log file when called from JAVA service. And no errors or exceptions are being generated too.
webMethods version 9.10
Using Package class loader
Any hints or pointers to resolve this is highly appreciated.
Tong_Wang
(Tong Wang)
August 15, 2017, 7:27pm
2
do you see any error messages in server log or error log when you call such logging service?
Hi, The log is getting written on the default location: /profiles/IS_default/logs/sag-osgi.log
And the logs are not getting written as configured inside the logback.xml file.
logback xml as below:
<configuration>
<property file="/product/softwareag/webmethods910/IntegrationServer/instances/default/packages/logBackPOC/config/logBack.properties" />
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned the type ch.qos.logback.classic.encoder.PatternLayoutEncoder
by default -->
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
</pattern>
</encoder>
</appender>
<appender name="ROLLINGFILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- <file>${logfilePath:-${fileLocation}}/myApp.log</file> -->
<prudent>true</prudent>
<encoder>
<pattern>%d %p [%t] %r %msg%n</pattern>
</encoder>
<rollingPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- daily rollover -->
<fileNamePattern>${logfilePath:-${fileLocation}}-%d{yyyy-MM-dd}.%i.log
</fileNamePattern>
<maxFileSize>20MB</maxFileSize>
<!-- keep 30 days' worth of history capped at 3GB total size -->
<maxHistory>30</maxHistory>
<totalSizeCap>20GB</totalSizeCap>
</rollingPolicy>
</appender>
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
<appender-ref ref="ROLLINGFILE" />
<discardingThreshold>0</discardingThreshold>
<queueSize>64</queueSize>
</appender>
<root level="debug">
<appender-ref ref="ROLLINGFILE" />
</root>
</configuration>
Hi,
Able to resolve the issue by updating the class loader settings to package class loader.
Administrators Guide documentation reference:
"Scenario Three: Package Class Loader Does Not Defer to the Integration Server Class Loader
By default, a package class loader defers the search for a class to its parent, which is
always the Integration Server class loader. There may be times, however, when you want
the package class loader to perform the search instead of deferring to the Integration
Server class loader. For example, you might have a package that contains a newer
version of a class than the one Integration Server is using.
To use the package class loader, specify the following in the manifest.v3 file for the
package:
packageā
"