Java Code Examples for com.alibaba.dubbo.common.utils.StringUtils#isInteger()

The following examples show how to use com.alibaba.dubbo.common.utils.StringUtils#isInteger() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MulticastRegistry.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private static boolean isMulticastAddress(String ip) {
    int i = ip.indexOf('.');
    if (i > 0) {
        String prefix = ip.substring(0, i);
        if (StringUtils.isInteger(prefix)) {
            int p = Integer.parseInt(prefix);
            return p >= 224 && p <= 239;
        }
    }
    return false;
}
 
Example 2
Source File: ClearTelnetHandler.java    From dubbo-2.6.5 with Apache License 2.0 5 votes vote down vote up
@Override
public String telnet(Channel channel, String message) {
    int lines = 100;
    if (message.length() > 0) {
        if (!StringUtils.isInteger(message)) {
            return "Illegal lines " + message + ", must be integer.";
        }
        lines = Integer.parseInt(message);
    }
    StringBuilder buf = new StringBuilder();
    for (int i = 0; i < lines; i++) {
        buf.append("\r\n");
    }
    return buf.toString();
}
 
Example 3
Source File: ClearTelnetHandler.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public String telnet(Channel channel, String message) {
    int lines = 100;
    if (message.length() > 0) {
        if (! StringUtils.isInteger(message)) {
            return "Illegal lines " + message + ", must be integer.";
        }
        lines = Integer.parseInt(message);
    }
    StringBuilder buf = new StringBuilder();
    for (int i = 0; i < lines; i ++) {
        buf.append("\r\n");
    }
    return buf.toString();
}
 
Example 4
Source File: ClearTelnetHandler.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
public String telnet(Channel channel, String message) {
    int lines = 100;
    if (message.length() > 0) {
        if (! StringUtils.isInteger(message)) {
            return "Illegal lines " + message + ", must be integer.";
        }
        lines = Integer.parseInt(message);
    }
    StringBuilder buf = new StringBuilder();
    for (int i = 0; i < lines; i ++) {
        buf.append("\r\n");
    }
    return buf.toString();
}
 
Example 5
Source File: MulticastGroup.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private static boolean isMulticastAddress(String ip) {
    int i = ip.indexOf('.');
    if (i > 0) {
        String prefix = ip.substring(0, i);
        if (StringUtils.isInteger(prefix)) {
            int p = Integer.parseInt(prefix);
            return p >= 224 && p <= 239;
        }
    }
    return false;
}
 
Example 6
Source File: MulticastGroup.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
private static boolean isMulticastAddress(String ip) {
    int i = ip.indexOf('.');
    if (i > 0) {
        String prefix = ip.substring(0, i);
        if (StringUtils.isInteger(prefix)) {
            int p = Integer.parseInt(prefix);
            return p >= 224 && p <= 239;
        }
    }
    return false;
}
 
Example 7
Source File: MulticastExchangeGroup.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
private static boolean isMulticastAddress(String ip) {
    int i = ip.indexOf('.');
    if (i > 0) {
        String prefix = ip.substring(0, i);
        if (StringUtils.isInteger(prefix)) {
            int p = Integer.parseInt(prefix);
            return p >= 224 && p <= 239;
        }
    }
    return false;
}
 
Example 8
Source File: MulticastRegistry.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
private static boolean isMulticastAddress(String ip) {
    int i = ip.indexOf('.');
    if (i > 0) {
        String prefix = ip.substring(0, i);
        if (StringUtils.isInteger(prefix)) {
            int p = Integer.parseInt(prefix);
            return p >= 224 && p <= 239;
        }
    }
    return false;
}
 
Example 9
Source File: MulticastExchangeGroup.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private static boolean isMulticastAddress(String ip) {
    int i = ip.indexOf('.');
    if (i > 0) {
        String prefix = ip.substring(0, i);
        if (StringUtils.isInteger(prefix)) {
            int p = Integer.parseInt(prefix);
            return p >= 224 && p <= 239;
        }
    }
    return false;
}
 
Example 10
Source File: MulticastRegistry.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private static boolean isMulticastAddress(String ip) {
    int i = ip.indexOf('.');
    if (i > 0) {
        String prefix = ip.substring(0, i);
        if (StringUtils.isInteger(prefix)) {
            int p = Integer.parseInt(prefix);
            return p >= 224 && p <= 239;
        }
    }
    return false;
}
 
Example 11
Source File: LogTelnetHandler.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public String telnet(Channel channel, String message) {
    long size = 0 ;
    File file = LoggerFactory.getFile();
    StringBuffer buf = new StringBuffer();
    if (message == null || message.trim().length() == 0) {
        buf.append("EXAMPLE: log error / log 100");
    }else {
        String str[] = message.split(" ");
        if (! StringUtils.isInteger(str[0])){
            LoggerFactory.setLevel(Level.valueOf(message.toUpperCase()));
        } else {
            int SHOW_LOG_LENGTH = Integer.parseInt(str[0]);
            
            if (file != null && file.exists()) {
                try{
                    FileInputStream fis = new FileInputStream(file);
                    try {
                     FileChannel filechannel = fis.getChannel();
                     try {
                      size = filechannel.size();
                      ByteBuffer bb;
                      if (size <= SHOW_LOG_LENGTH) {
                          bb = ByteBuffer.allocate((int) size);
                          filechannel.read(bb, 0);
                      } else {
                          int pos = (int) (size - SHOW_LOG_LENGTH);
                          bb = ByteBuffer.allocate(SHOW_LOG_LENGTH);
                          filechannel.read(bb, pos);
                      }
                      bb.flip();
                      String content = new String(bb.array()).replace("<", "&lt;")
                      .replace(">", "&gt;").replace("\n", "<br/><br/>");
                      buf.append("\r\ncontent:"+content);
                      
                      buf.append("\r\nmodified:"+(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
                      .format(new Date(file.lastModified()))));
                      buf.append("\r\nsize:"+size +"\r\n");
                     } finally {
                     	filechannel.close();
                     }
                    } finally {
                    	fis.close();
                    }
                }catch (Exception e) {
                    buf.append(e.getMessage());
                }
            }else {
                size = 0;
                buf.append("\r\nMESSAGE: log file not exists or log appender is console .");
            }
        }
    }
    buf.append("\r\nCURRENT LOG LEVEL:"+ LoggerFactory.getLevel())
    .append("\r\nCURRENT LOG APPENDER:"+ (file == null ? "console" : file.getAbsolutePath()));
    return buf.toString();
}
 
Example 12
Source File: TraceTelnetHandler.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
public String telnet(Channel channel, String message) {
    String service = (String) channel.getAttribute(ChangeTelnetHandler.SERVICE_KEY);
    if ((service == null || service.length() == 0)
            && (message == null || message.length() == 0)) {
        return "Please input service name, eg: \r\ntrace XxxService\r\ntrace XxxService xxxMethod\r\ntrace XxxService xxxMethod 10\r\nor \"cd XxxService\" firstly.";
    }
    String[] parts = message.split("\\s+");
    String method;
    String times;
    if (service == null || service.length() == 0) {
        service = parts.length > 0 ? parts[0] : null;
        method = parts.length > 1 ? parts[1] : null;
    } else {
        method = parts.length > 0 ? parts[0] : null;
    }
    if (StringUtils.isInteger(method)) {
        times = method;
        method = null;
    } else {
        times = parts.length > 2 ? parts[2] : "1";
    }
    if (! StringUtils.isInteger(times)) {
        return "Illegal times " + times + ", must be integer.";
    }
    Invoker<?> invoker = null;
    for (Exporter<?> exporter : DubboProtocol.getDubboProtocol().getExporters()) {
        if (service.equals(exporter.getInvoker().getInterface().getSimpleName())
                || service.equals(exporter.getInvoker().getInterface().getName())
                || service.equals(exporter.getInvoker().getUrl().getPath())) {
            invoker = exporter.getInvoker();
            break;
        }
    }
    if (invoker != null) {
        if (method != null && method.length() > 0) {
            boolean found = false;
            for (Method m : invoker.getInterface().getMethods()) {
                if (m.getName().equals(method)) {
                    found = true;
                    break;
                }
            }
            if (! found) {
                return "No such method " + method + " in class " + invoker.getInterface().getName();
            }
        }
        TraceFilter.addTracer(invoker.getInterface(), method, channel, Integer.parseInt(times));
    } else {
        return "No such service " + service;
    }
    return null;
}
 
Example 13
Source File: LogTelnetHandler.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
public String telnet(Channel channel, String message) {
    long size = 0 ;
    File file = LoggerFactory.getFile();
    StringBuffer buf = new StringBuffer();
    if (message == null || message.trim().length() == 0) {
        buf.append("EXAMPLE: log error / log 100");
    }else {
        String str[] = message.split(" ");
        if (! StringUtils.isInteger(str[0])){
            LoggerFactory.setLevel(Level.valueOf(message.toUpperCase()));
        } else {
            int SHOW_LOG_LENGTH = Integer.parseInt(str[0]);
            
            if (file != null && file.exists()) {
                try{
                    FileInputStream fis = new FileInputStream(file);
                    try {
                     FileChannel filechannel = fis.getChannel();
                     try {
                      size = filechannel.size();
                      ByteBuffer bb;
                      if (size <= SHOW_LOG_LENGTH) {
                          bb = ByteBuffer.allocate((int) size);
                          filechannel.read(bb, 0);
                      } else {
                          int pos = (int) (size - SHOW_LOG_LENGTH);
                          bb = ByteBuffer.allocate(SHOW_LOG_LENGTH);
                          filechannel.read(bb, pos);
                      }
                      bb.flip();
                      String content = new String(bb.array()).replace("<", "&lt;")
                      .replace(">", "&gt;").replace("\n", "<br/><br/>");
                      buf.append("\r\ncontent:"+content);
                      
                      buf.append("\r\nmodified:"+(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
                      .format(new Date(file.lastModified()))));
                      buf.append("\r\nsize:"+size +"\r\n");
                     } finally {
                     	filechannel.close();
                     }
                    } finally {
                    	fis.close();
                    }
                }catch (Exception e) {
                    buf.append(e.getMessage());
                }
            }else {
                size = 0;
                buf.append("\r\nMESSAGE: log file not exists or log appender is console .");
            }
        }
    }
    buf.append("\r\nCURRENT LOG LEVEL:"+ LoggerFactory.getLevel())
    .append("\r\nCURRENT LOG APPENDER:"+ (file == null ? "console" : file.getAbsolutePath()));
    return buf.toString();
}
 
Example 14
Source File: LogTelnetHandler.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public String telnet(Channel channel, String message) {
    long size = 0 ;
    File file = LoggerFactory.getFile();
    StringBuffer buf = new StringBuffer();
    if (message == null || message.trim().length() == 0) {
        buf.append("EXAMPLE: log error / log 100");
    }else {
        String str[] = message.split(" ");
        if (! StringUtils.isInteger(str[0])){
            LoggerFactory.setLevel(Level.valueOf(message.toUpperCase()));
        } else {
            int SHOW_LOG_LENGTH = Integer.parseInt(str[0]);
            
            if (file != null && file.exists()) {
                try{
                    FileInputStream fis = new FileInputStream(file);
                    FileChannel filechannel = fis.getChannel();
                    size = filechannel.size();
                    ByteBuffer bb;
                    if (size <= SHOW_LOG_LENGTH) {
                        bb = ByteBuffer.allocate((int) size);
                        filechannel.read(bb, 0);
                    } else {
                        int pos = (int) (size - SHOW_LOG_LENGTH);
                        bb = ByteBuffer.allocate(SHOW_LOG_LENGTH);
                        filechannel.read(bb, pos);
                    }
                    bb.flip();
                    String content = new String(bb.array()).replace("<", "&lt;")
                    .replace(">", "&gt;").replace("\n", "<br/><br/>");
                    buf.append("\r\ncontent:"+content);
                    
                    buf.append("\r\nmodified:"+(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
                    .format(new Date(file.lastModified()))));
                    buf.append("\r\nsize:"+size +"\r\n");
                }catch (Exception e) {
                    buf.append(e.getMessage());
                }
            }else {
                size = 0;
                buf.append("\r\nMESSAGE: log file not exists or log appender is console .");
            }
        }
    }
    buf.append("\r\nCURRENT LOG LEVEL:"+ LoggerFactory.getLevel())
    .append("\r\nCURRENT LOG APPENDER:"+ (file == null ? "console" : file.getAbsolutePath()));
    return buf.toString();
}
 
Example 15
Source File: TraceTelnetHandler.java    From dubbo3 with Apache License 2.0 4 votes vote down vote up
public String telnet(Channel channel, String message) {
    String service = (String) channel.getAttribute(ChangeTelnetHandler.SERVICE_KEY);
    if ((service == null || service.length() == 0)
            && (message == null || message.length() == 0)) {
        return "Please input service name, eg: \r\ntrace XxxService\r\ntrace XxxService xxxMethod\r\ntrace XxxService xxxMethod 10\r\nor \"cd XxxService\" firstly.";
    }
    String[] parts = message.split("\\s+");
    String method;
    String times;
    if (service == null || service.length() == 0) {
        service = parts.length > 0 ? parts[0] : null;
        method = parts.length > 1 ? parts[1] : null;
    } else {
        method = parts.length > 0 ? parts[0] : null;
    }
    if (StringUtils.isInteger(method)) {
        times = method;
        method = null;
    } else {
        times = parts.length > 2 ? parts[2] : "1";
    }
    if (! StringUtils.isInteger(times)) {
        return "Illegal times " + times + ", must be integer.";
    }
    Invoker<?> invoker = null;
    for (Exporter<?> exporter : DubboProtocol.getDubboProtocol().getExporters()) {
        if (service.equals(exporter.getInvoker().getInterface().getSimpleName())
                || service.equals(exporter.getInvoker().getInterface().getName())
                || service.equals(exporter.getInvoker().getUrl().getPath())) {
            invoker = exporter.getInvoker();
            break;
        }
    }
    if (invoker != null) {
        if (method != null && method.length() > 0) {
            boolean found = false;
            for (Method m : invoker.getInterface().getMethods()) {
                if (m.getName().equals(method)) {
                    found = true;
                    break;
                }
            }
            if (! found) {
                return "No such method " + method + " in class " + invoker.getInterface().getName();
            }
        }
        TraceFilter.addTracer(invoker.getInterface(), method, channel, Integer.parseInt(times));
    } else {
        return "No such service " + service;
    }
    return null;
}
 
Example 16
Source File: LogTelnetHandler.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public String telnet(Channel channel, String message) {
    long size = 0 ;
    File file = LoggerFactory.getFile();
    StringBuffer buf = new StringBuffer();
    if (message == null || message.trim().length() == 0) {
        buf.append("EXAMPLE: log error / log 100");
    }else {
        String str[] = message.split(" ");
        if (! StringUtils.isInteger(str[0])){
            LoggerFactory.setLevel(Level.valueOf(message.toUpperCase()));
        } else {
            int SHOW_LOG_LENGTH = Integer.parseInt(str[0]);
            
            if (file != null && file.exists()) {
                try{
                    FileInputStream fis = new FileInputStream(file);
                    try {
                     FileChannel filechannel = fis.getChannel();
                     try {
                      size = filechannel.size();
                      ByteBuffer bb;
                      if (size <= SHOW_LOG_LENGTH) {
                          bb = ByteBuffer.allocate((int) size);
                          filechannel.read(bb, 0);
                      } else {
                          int pos = (int) (size - SHOW_LOG_LENGTH);
                          bb = ByteBuffer.allocate(SHOW_LOG_LENGTH);
                          filechannel.read(bb, pos);
                      }
                      bb.flip();
                      String content = new String(bb.array()).replace("<", "&lt;")
                      .replace(">", "&gt;").replace("\n", "<br/><br/>");
                      buf.append("\r\ncontent:"+content);
                      
                      buf.append("\r\nmodified:"+(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
                      .format(new Date(file.lastModified()))));
                      buf.append("\r\nsize:"+size +"\r\n");
                     } finally {
                     	filechannel.close();
                     }
                    } finally {
                    	fis.close();
                    }
                }catch (Exception e) {
                    buf.append(e.getMessage());
                }
            }else {
                size = 0;
                buf.append("\r\nMESSAGE: log file not exists or log appender is console .");
            }
        }
    }
    buf.append("\r\nCURRENT LOG LEVEL:"+ LoggerFactory.getLevel())
    .append("\r\nCURRENT LOG APPENDER:"+ (file == null ? "console" : file.getAbsolutePath()));
    return buf.toString();
}
 
Example 17
Source File: LogTelnetHandler.java    From dubbo3 with Apache License 2.0 4 votes vote down vote up
public String telnet(Channel channel, String message) {
    long size = 0;
    File file = LoggerFactory.getFile();
    StringBuilder buf = new StringBuilder();
    if (message == null || message.trim().length() == 0) {
        buf.append("EXAMPLE: log error / log 100");
    } else {
        String str[] = message.split(" ");
        if (!StringUtils.isInteger(str[0])) {
            LoggerFactory.setLevel(Level.valueOf(message.toUpperCase()));
        } else {
            int SHOW_LOG_LENGTH = Integer.parseInt(str[0]);

            if (file != null && file.exists()) {
                try {
                    try (FileInputStream fis = new FileInputStream(file)) {
                        try (FileChannel filechannel = fis.getChannel()) {
                            size = filechannel.size();
                            ByteBuffer bb;
                            if (size <= SHOW_LOG_LENGTH) {
                                bb = ByteBuffer.allocate((int) size);
                                filechannel.read(bb, 0);
                            } else {
                                int pos = (int) (size - SHOW_LOG_LENGTH);
                                bb = ByteBuffer.allocate(SHOW_LOG_LENGTH);
                                filechannel.read(bb, pos);
                            }
                            bb.flip();
                            String content = new String(bb.array()).replace("<", "&lt;")
                                    .replace(">", "&gt;").replace("\n", "<br/><br/>");
                            buf.append("\r\ncontent:" + content);

                            buf.append("\r\nmodified:" + (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
                                    .format(new Date(file.lastModified()))));
                            buf.append("\r\nsize:" + size + "\r\n");
                        }
                    }
                } catch (Exception e) {
                    buf.append(e.getMessage());
                }
            } else {
                size = 0;
                buf.append("\r\nMESSAGE: log file not exists or log appender is console .");
            }
        }
    }
    buf.append("\r\nCURRENT LOG LEVEL:" + LoggerFactory.getLevel())
            .append("\r\nCURRENT LOG APPENDER:" + (file == null ? "console" : file.getAbsolutePath()));
    return buf.toString();
}
 
Example 18
Source File: TraceTelnetHandler.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public String telnet(Channel channel, String message) {
    String service = (String) channel.getAttribute(ChangeTelnetHandler.SERVICE_KEY);
    if ((service == null || service.length() == 0)
            && (message == null || message.length() == 0)) {
        return "Please input service name, eg: \r\ntrace XxxService\r\ntrace XxxService xxxMethod\r\ntrace XxxService xxxMethod 10\r\nor \"cd XxxService\" firstly.";
    }
    String[] parts = message.split("\\s+");
    String method;
    String times;
    if (service == null || service.length() == 0) {
        service = parts.length > 0 ? parts[0] : null;
        method = parts.length > 1 ? parts[1] : null;
    } else {
        method = parts.length > 0 ? parts[0] : null;
    }
    if (StringUtils.isInteger(method)) {
        times = method;
        method = null;
    } else {
        times = parts.length > 2 ? parts[2] : "1";
    }
    if (! StringUtils.isInteger(times)) {
        return "Illegal times " + times + ", must be integer.";
    }
    Invoker<?> invoker = null;
    for (Exporter<?> exporter : DubboProtocol.getDubboProtocol().getExporters()) {
        if (service.equals(exporter.getInvoker().getInterface().getSimpleName())
                || service.equals(exporter.getInvoker().getInterface().getName())
                || service.equals(exporter.getInvoker().getUrl().getPath())) {
            invoker = exporter.getInvoker();
            break;
        }
    }
    if (invoker != null) {
        if (method != null && method.length() > 0) {
            boolean found = false;
            for (Method m : invoker.getInterface().getMethods()) {
                if (m.getName().equals(method)) {
                    found = true;
                    break;
                }
            }
            if (! found) {
                return "No such method " + method + " in class " + invoker.getInterface().getName();
            }
        }
        TraceFilter.addTracer(invoker.getInterface(), method, channel, Integer.parseInt(times));
    } else {
        return "No such service " + service;
    }
    return null;
}
 
Example 19
Source File: LogTelnetHandler.java    From dubbo-2.6.5 with Apache License 2.0 4 votes vote down vote up
@Override
public String telnet(Channel channel, String message) {
    long size = 0;
    File file = LoggerFactory.getFile();
    StringBuffer buf = new StringBuffer();
    if (message == null || message.trim().length() == 0) {
        buf.append("EXAMPLE: log error / log 100");
    } else {
        String str[] = message.split(" ");
        if (!StringUtils.isInteger(str[0])) {
            LoggerFactory.setLevel(Level.valueOf(message.toUpperCase()));
        } else {
            int SHOW_LOG_LENGTH = Integer.parseInt(str[0]);

            if (file != null && file.exists()) {
                try {
                    FileInputStream fis = new FileInputStream(file);
                    try {
                        FileChannel filechannel = fis.getChannel();
                        try {
                            size = filechannel.size();
                            ByteBuffer bb;
                            if (size <= SHOW_LOG_LENGTH) {
                                bb = ByteBuffer.allocate((int) size);
                                filechannel.read(bb, 0);
                            } else {
                                int pos = (int) (size - SHOW_LOG_LENGTH);
                                bb = ByteBuffer.allocate(SHOW_LOG_LENGTH);
                                filechannel.read(bb, pos);
                            }
                            bb.flip();
                            String content = new String(bb.array()).replace("<", "&lt;")
                                    .replace(">", "&gt;").replace("\n", "<br/><br/>");
                            buf.append("\r\ncontent:" + content);

                            buf.append("\r\nmodified:" + (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
                                    .format(new Date(file.lastModified()))));
                            buf.append("\r\nsize:" + size + "\r\n");
                        } finally {
                            filechannel.close();
                        }
                    } finally {
                        fis.close();
                    }
                } catch (Exception e) {
                    buf.append(e.getMessage());
                }
            } else {
                size = 0;
                buf.append("\r\nMESSAGE: log file not exists or log appender is console .");
            }
        }
    }
    buf.append("\r\nCURRENT LOG LEVEL:" + LoggerFactory.getLevel())
            .append("\r\nCURRENT LOG APPENDER:" + (file == null ? "console" : file.getAbsolutePath()));
    return buf.toString();
}
 
Example 20
Source File: LogTelnetHandler.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public String telnet(Channel channel, String message) {
    long size = 0 ;
    File file = LoggerFactory.getFile();
    StringBuffer buf = new StringBuffer();
    if (message == null || message.trim().length() == 0) {
        buf.append("EXAMPLE: log error / log 100");
    }else {
        String str[] = message.split(" ");
        if (! StringUtils.isInteger(str[0])){
            LoggerFactory.setLevel(Level.valueOf(message.toUpperCase()));
        } else {
            int SHOW_LOG_LENGTH = Integer.parseInt(str[0]);
            
            if (file != null && file.exists()) {
                try{
                    FileInputStream fis = new FileInputStream(file);
                    FileChannel filechannel = fis.getChannel();
                    size = filechannel.size();
                    ByteBuffer bb;
                    if (size <= SHOW_LOG_LENGTH) {
                        bb = ByteBuffer.allocate((int) size);
                        filechannel.read(bb, 0);
                    } else {
                        int pos = (int) (size - SHOW_LOG_LENGTH);
                        bb = ByteBuffer.allocate(SHOW_LOG_LENGTH);
                        filechannel.read(bb, pos);
                    }
                    bb.flip();
                    String content = new String(bb.array()).replace("<", "&lt;")
                    .replace(">", "&gt;").replace("\n", "<br/><br/>");
                    buf.append("\r\ncontent:"+content);
                    
                    buf.append("\r\nmodified:"+(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
                    .format(new Date(file.lastModified()))));
                    buf.append("\r\nsize:"+size +"\r\n");
                }catch (Exception e) {
                    buf.append(e.getMessage());
                }
            }else {
                size = 0;
                buf.append("\r\nMESSAGE: log file not exists or log appender is console .");
            }
        }
    }
    buf.append("\r\nCURRENT LOG LEVEL:"+ LoggerFactory.getLevel())
    .append("\r\nCURRENT LOG APPENDER:"+ (file == null ? "console" : file.getAbsolutePath()));
    return buf.toString();
}