LrJposChannel.getLogger
Gets the logger associated with the channel.
public static Logger getLogger()
Return values
This function returns the logger (org.jpos.util.Logger) instance associated with the channel.
Example
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 logs 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);
}
}