LrJposChannel.getOriginalRealm

Gets the original realm (identifier) for the logger associated with the channel.

public static String getOriginalRealm()

Return values

This function returns a string that represents the original logger realm.

General information

The realm can change over time, but the first realm is always remembered. The original realm is set by default by the jPOS library, and consists of the channel type, IP of the current machine, and the port.

For example, org.jpos.iso.channel.ASCIIChannel/xxx.xxx.xxx.xxx:8000

Example

Copy code
public void binary2003_logger() throws Throwable{

        //system.out logger
        Logger consoleLogger = new Logger();
        consoleLogger.addListener(new SimpleLogListener(System.out));
        
        //adding logger to the channel
        LrJposChannel.setLogger(consoleLogger, "consoleLogger");
        
        lr.output_message("Realm: " + LrJposChannel.getRealm());
        lr.output_message("OriginalRealm: " + LrJposChannel.getOriginalRealm());
       
        //read message from file
        LrISOMsg msg= new LrISOMsg();
        msg.setPackager(new XMLPackager());
        InputStream stream = new FileInputStream("message1.xml");
        msg.unpack(stream);
        
        for (int i=1; i<8; i++) {
            msg.set(11, createMessageTrace(i));
            LrJposChannel.send(msg);
        }
        
        //add loggs to file:
        //received message should be logged on console and in specified file
        PrintStream output = new PrintStream("ISOLogFile.log");
        Logger logger = LrJposChannel.getLogger();
        logger.addListener(new SimpleLogListener(output));
        
        LrISOMsg r = new LrISOMsg();
        while (r != null) {
            r = LrJposChannel.receive(5);
        }
}