How to display the console information

i am a newer ,i have build the openfire source ,i want to display the xml information on console when debug it ,but how?

thanks

What exactly do you mean with “xml information”?

Did you mean XMPP Packets? Since you want to compile the sourcecode, I assume you are an programmer. Everything you need is a simple plugin that implements PacketInterceptor interface and writes all packets to one of the logfiles.

Useful links:

http://www.igniterealtime.org/projects/openfire/documentation.jsp

The openfire has been compiled, when i log in the server using the spark ,i want to see what has been transported over the TCP on the port 5222.

That is to say ,what has the server sent and what has the server received? i only know that the content what the server send and received is in form of xml.

in the source code file,Maybe a line of code which takes charge of outputing the content transfered between the server and client is shielded.but i do not know which line.

i hope for support

thx

i want to see what has been transported over the TCP on the port 5222.

If you are really interested in TCP layer traffic, I suggest you use some kind of traffic monitoring tool. E.g. iptraf for Linux.

i only know that the content what the server send and received is in form of xml.

The protocol is named XMPP. => XMPP | Specifications

The following plugin would be a minimal plugin for logging all XML data the goes through the server into info.log.

package org.jivesoftware.openfire.plugin; import java.io.File;
import org.jivesoftware.openfire.container.Plugin;
import org.jivesoftware.openfire.container.PluginManager;
import org.jivesoftware.util.Log;
import org.jivesoftware.openfire.interceptor.PacketInterceptor;
import org.jivesoftware.openfire.interceptor.InterceptorManager;
import org.jivesoftware.openfire.session.Session;
import org.xmpp.packet.Packet; public class PacketLog implements Plugin, PacketInterceptor {
     public void initializePlugin(PluginManager pluginManager, File pluginDirectory) {
          Log.info("PacketLog: initializePlugin");
          InterceptorManager.getInstance().addInterceptor(this);
     }      public void destroyPlugin() {
          Log.info("PacketLog: destroyPlugin");
          InterceptorManager.getInstance()..removeInterceptor(this);
     }      public void interceptPacket(Packet packet, Session session, boolean incoming, boolean processed) {
          if (processed) { return; }
          Log.info("Packet: " + (incoming ? "in" : "out") + packet.toString());
     }
}

P.S.: I have problems to understand your English. Maybe I have misunderstood you.

Hi,

when you start “Spark” you can choose to enable the debug window. It will then display all sent and received packets. If you start Spark with auto-login you need to log out manually to enable this window.

“Openfire” has a Message Audit Policy (http://localhost:9090/audit-policy.jsp) which you can enable. It will write the XMPP packets to a file.

LG

@it2000, thanks for your help.

it is very useful!