Java service outPut

Hello All,

When we are making any java service in designer.Where does out put for System.out.println get printed.Not getting this values either in console or any server/error log.
What syntex do we need to apply to write server log or error Log.

Please provide your feedback.

Thanks
Baharul

Hi,

I used below code to write to server.log on developer wM 7.1.2. Hope the same works on designer.

com.wm.util.JournalLogger.log( com.wm.util.JournalLogger.INFO,
com.wm.util.JournalLogger.FAC_FLOW_SVC,
com.wm.util.JournalLogger.DEBUG,
“DEBUG TEXT HERE!” );

You may wish to wrap this up in a service for convenience and put it in the shared section of your code (or in a utility class):

public static void debugLog(String text)
{

com.wm.util.JournalLogger.log( com.wm.util.JournalLogger.INFO,
com.wm.util.JournalLogger.FAC_FLOW_SVC,
com.wm.util.JournalLogger.DEBUG,
text );
}
Then in your code you can simply call:

debugLog(“hello there”);

For wM 8.2

Have a look at the below link

Are you running the IS on Windows or Unix?
If on Windows, is IS running as a Service or as an Application?

For a Service on Windows there will be no such Output.

For an Application on Windows as well as for Unix there is output availabler either to a Command Prompt Window on Windows or in the nohup.out on Unix.

To write to server log you have to use the service pub.flow:debugLog, which can be called from java services too.

See Build-In Services Guide and Java Service Developers Guide for further information.

Regards,
Holger

Thanks Mahesh & Holger.
Currenly using wm version is 9.0 and runnins as Service in windows System.
So there will be no console output for System.out command.

@Mahesh,
I have tried with JournalLogger but this was not working for me.Will again try and let you know the result.

Thanks
Baharul

Please try:


JournalLogger.log(4, JournalLogger.FAC_FLOW_SVC, JournalLogger.DEBUG,"function", "message");

@Baharul,

println sends output to console. In case of unix, you see in nohup.out. In windows if server started as application, you can view the println in console output. If IS is running as service on windows there is no way[ as far as I know].

I suggest write a small code in Source:

public static void logger (String message) {

IData input = IDataFactory.create();
IDataCursor inputCursor = input.getCursor();
IDataUtil.put( inputCursor, "message", message );
IDataUtil.put( inputCursor, "function", "customLogger" );
IDataUtil.put( inputCursor, "level", "INFO" );
inputCursor.destroy();

IData 	output = IDataFactory.create();
try{
	output = Service.doInvoke( "pub.flow", "debugLog", input );
}catch( Exception e){}
}

and use logger(“log Message”); in your java code

everytime you need to send something in serverlog/debug data.

BTW JournalLogger is nothing but just a different representation of debugLog.

HTH.

Thanks,
Rankesh

1 Like

Thanks Rankesh.
This JournalLogger or custom code to invoke DebugLog service is working.

Thanks
Baharul

1 Like

If you’re using the System.out.println() function, it may be in the “wrapper.log”.

Should be here :
\profiles\IS\logs\wrapper.log

Rankesh,
I know this is an Old post, but was still pretty effective - while I was trying to debug a Java service invoking an External AMZ Client libray services. Thanks.

As Arnaud mentioned .

System.out.println() function is written on to the wrapper.log file

\profiles\IS\logs\wrapper.log

Hi,

additionally there is the option to redirect the standard output to nohup.out, esp. on Unix systems.

Regards,
Holger