Common Logging Problems

Posted by Admin on 10-Jul-2008 01:48

All Replies

Posted by jtownsen on 10-Jul-2008 03:50

Not knowing anything about this other application, I can't comment on where the messages are actually going to, but the easiest way to print things in the container log is to do something like "m_xqLog = initialContext.getLog();" in your init() method and "m_xqLog.logDebug()" in your service() implementation. You can also use logInformation, logWarning & logError.

Posted by Admin on 11-Jul-2008 00:34

I can use with m_xqLog.logDebug() by passing the XQ_log in the class, but the application is already exist, wherein common logging is done.

I think wecan plugin the common logging with any logging system, i have seen the common logging was working with when i used with the sonic version 7.0.

Posted by jtownsen on 11-Jul-2008 02:19

Later versions of Sonic use Log4J, which makes it very simple to centralise logging into a common target.

Can you tell us what version you're running now and perhaps a bit of code that enabled the common logging to work in 7.0?

Posted by Admin on 29-Jul-2008 09:57

I am using version 7.5

Posted by Admin on 29-Jul-2008 10:04

Here is the method and import statement that i am pasting from the file

It was working when i used the same code with the version 7.0, now it is not working i means logging is not printing..

/* IMPORTS */

import java.util.Vector;

import javax.jms.QueueSender;

import javax.jms.DeliveryMode;

import javax.jms.TemporaryQueue;

import org.apache.commons.logging.Log;

import org.apache.commons.logging.LogFactory;

import progress.message.jclient.XMLMessage;

//import progress.message.

import progress.message.jclient.Queue;

import progress.message.jclient.QueueConnection;

import progress.message.jclient.QueueReceiver;

import progress.message.jclient.QueueSession;

/*

Method

*/

public String requestReponse(String reqMsg, String xmlRoot) throws Exception {

//Define new JMS Session related objects

QueueSession mySession = null;

QueueReceiver myReceiver = null;

QueueSender mySender = null;

Exception serviceExcpetion = null;

TemporaryQueue tmpQ = null;

String respMsg = "";

Vector vConnection = new Vector(2);

try {

//get a new session thread

vConnection = jmsSessionFactory.createSession();

mySession = (QueueSession)vConnection.elementAt(1);

myReceiver = this.createNewReceiver(mySession);

mySender = this.createNewSender(mySession);

//create message object

XMLMessage msg = mySession.createXMLMessage();

tmpQ = (TemporaryQueue)myReceiver.getQueue();

msg.setJMSReplyTo(tmpQ);

msg.setText(reqMsg);

//send message object

log.debug("sending xml to: "mySender.getDestination()"\n"+msg.getText());

mySender.send(msg);

//get response

XMLMessage recmsg = (progress.message.jclient.XMLMessage) myReceiver.receive(SonicConnectionManager.MQMsgTimeoutMS);

if (null!=recmsg) {

respMsg = recmsg.getText();

} else {

serviceExcpetion = new Exception(ServiceConstants.SEC_MD_TIMEOUT);

}

log.debug("Resp Msg =" + respMsg);

////System.out.println("Resp Msg =" + respMsg);

} catch (Exception e) {

//e.printStackTrace();

log.error(e.getMessage());

serviceExcpetion = new Exception(ServiceConstants.SEC_MD_INVALID_DESTINATION);

} finally {

try {

//Clean up in this order so no JMSException will result

mySender.close();

//TemporaryQueue tmpQ = (TemporaryQueue)myReceiver.getQueue();

myReceiver.close();

tmpQ.delete();

jmsSessionFactory.releaseQueueSession(mySession, ((Integer)vConnection.elementAt(0)).intValue(), (QueueConnection)vConnection.elementAt(2));

//SCM.releaseConnection(myConnection);

}

catch (Exception closeOutException) {

log.debug(closeOutException.getLocalizedMessage());

}

vConnection = null;

myReceiver = null;

mySender = null;

mySession = null;

}

if (null!=serviceExcpetion)

return respMsg;

}

Posted by Admin on 29-Jul-2008 10:07

Jemie,

I am sorry, i don't know if there is anything we need to enable for the common logging, I think we can plugin the common logging with any kind of logging system.

Posted by jtownsen on 04-Aug-2008 09:41

Could it be that you just need to set the Tracing on the ESB Container to Enable Debug Messages??

Posted by Admin on 08-Aug-2008 02:22

Hi Jemmie,

I did tried this as well, but not getting any desired result, i means logging not printing.

Posted by jtownsen on 08-Aug-2008 02:59

Without knowing exactly how your log is being initialised, I can only guess that you're perhaps now using log4j. If this is the case, the following might help.

The settings for the log4j logging level default to "info". One simple way to change that value is to place a new version of the log4j.xml file in the SonicFS and reference it in the Container Properties -> Environment tab -> Java VM Options (add " -DSonicESB.log4j.configuration=sonicfs:///path/to/log4j.xml")

Here is a sample log4j.xml which will show debug messages:

[%d][%X][%X]

Posted by jtownsen on 18-Aug-2008 09:16

Just curious if this solved it for you?

Posted by jtownsen on 02-Oct-2008 09:24

Not having heard back, I'm going to assume that this suggestion in fact did not solve the issue as it didn't solve it in another case.

The correct solution is to enable the ESB Container properties: JAX-RPC Debug Tracing (2048), JAX-RPC Informational Messages (4096) & JAX-RPC Warning Messages (8192).

Posted by sedge on 19-Dec-2011 17:08

Hi Jamie

I'm using Hibernate with my Sonic 8.5 development and trying to use Hibernate logging (log4j). I've been researching the community and your articles but Sonic 8.5 configuration appears a little different to 7.x (that I've never used).

Can you show me how to go about it? I assume I have to add the Hibernate logging parameters to Sonic's log4j properties configuration but I can't locate it from the information in your article (perhaps I'm not reading it correctly!).

Thanks

Steve

This thread is closed