LrJposChannel.getRealm

Returns the current realm (identifier) for the logger associated with the channel.

public static String getRealm()

Return values

This function returns a string that represents the logger realm.

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);
        }
}