configure logback on webmethods

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.

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. :frowning:

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: