type PortForwarderConstants.LOG_LEVEL_DEBUG and
PortForwarderConstants.LOG_LEVEL_DEBUG_VERBOSE.
The PortForwarderLogger is added to the Port Forwarder by calling the setLogger function.
Example
Following is an example of the code for adding a Port Forwarder logger.
public class PortForwarderLoggerImpl implements PortForwarderLogger {
private final ResourceBundle messages;
private PortForwarderGui portForwarderGui;
/**
* Creates a new instance of PortForwarderLoggerImpl
*/
public PortForwarderLoggerImpl() {
messages = ResourceBundle.getBundle("Messages");
}
/**
* Tells the logger in which gui to log messages.
*
* @param portForwarderGui The gui to use
*/
public void setGui(PortForwarderGui portForwarderGui) {
this.portForwarderGui = portForwarderGui;
}
private String createTimeStamp() {
SimpleDateFormat dateFormat = new SimpleDateFormat("hh:mm:ss.SSS");
String timeStamp = dateFormat.format(new Date());
return timeStamp;
}
private String createMessage(String msg) {
return createTimeStamp() + " : " + msg;
}
public void log(final int logLevel, final int logCode,
final Object[] params, final Throwable throwable) {
if ((logLevel == PortForwarderConstants.LOG_LEVEL_ERROR) ||
(logLevel == PortForwarderConstants.LOG_LEVEL_INFO)) {
String msg =
MessageFormat.format(messages.getString("" + logCode),
params);
String messageString = createMessage(msg);
if (portForwarderGui == null) {
System.err.println("WARNING: Could not write to info area!");
System.err.println(messageString);
if (throwable != null) {
System.out.println(throwable.getMessage());
throwable.printStackTrace();
}
} else {
portForwarderGui.appendInfo(message
System.getProperty("line.separator"));
if (throwable != null) {
portForwarderGui.appendInfo(throwable.getMessage() +
System.getProperty("line.separator"));
throwable.printStackTrace();
}
Adding a Port Forwarder Logger
User Guide
April 2013 261
Summary of Contents for 3050-VM
Page 1: ...User Guide Avaya VPN Gateway Release 9 0 NN46120 104 Issue 04 04 April 2013 ...
Page 4: ...4 User Guide April 2013 Comments infodev avaya com ...
Page 12: ...12 User Guide April 2013 ...
Page 20: ...New in this release 20 User Guide April 2013 Comments infodev avaya com ...
Page 30: ...Introducing the VPN Gateway 30 User Guide April 2013 Comments infodev avaya com ...
Page 36: ...Introducing the ASA 310 FIPS 36 User Guide April 2013 Comments infodev avaya com ...
Page 74: ...Upgrading the AVG Software 74 User Guide April 2013 Comments infodev avaya com ...
Page 86: ...Managing Users and Groups 86 User Guide April 2013 Comments infodev avaya com ...
Page 130: ...The Command Line Interface 130 User Guide April 2013 Comments infodev avaya com ...
Page 162: ...Supported Ciphers 162 User Guide April 2013 Comments infodev avaya com ...
Page 212: ...Syslog Messages 212 User Guide April 2013 Comments infodev avaya com ...
Page 242: ...Definition of Key Codes 242 User Guide April 2013 Comments infodev avaya com ...
Page 259: ...Creating a Port Forwarder Authenticator User Guide April 2013 259 ...
Page 266: ...Using the Port Forwarder API 266 User Guide April 2013 Comments infodev avaya com ...
Page 274: ...X 509 274 User Guide April 2013 Comments infodev avaya com ...