Changeset afa5a19


Ignore:
Timestamp:
Aug 21, 2016 8:21:50 PM (4 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
2fd0ed1
Parents:
b0789d4
Message:

Console: Add jsps to view entire router.log and wrapper.log files
Add links to /logs
Add some headers to the history.txt jsp
javadocs

Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/java/src/net/i2p/router/web/LocaleWebAppHandler.java

    rb0789d4 rafa5a19  
    6464        } else if (pathInContext.indexOf("/", 1) < 0 &&
    6565                   (!pathInContext.endsWith(".jsp")) &&
     66                   (!pathInContext.endsWith(".log")) &&
    6667                   (!pathInContext.endsWith(".txt"))) {
    6768            // add .jsp to pages at top level
  • apps/routerconsole/java/src/net/i2p/router/web/LogsHelper.java

    rb0789d4 rafa5a19  
    7676    public String getLogs() {
    7777        String str = formatMessages(_context.logManager().getBuffer().getMostRecentMessages());
    78         return "<p>" + _t("File location") + ": <b><code>" + _context.logManager().currentFile() + "</code></b></p>" + str;
     78        return "<p>" + _t("File location") + ": <a href=\"/router.log\">" + _context.logManager().currentFile() + "</a></p>" + str;
    7979    }
    8080   
     
    8989    /**
    9090     *  Does not necessarily exist.
    91      *  @since 0.9.1
    92      */
    93     static File wrapperLogFile(I2PAppContext ctx) {
     91     *
     92     *  @return non-null, doesn't necessarily exist
     93     *  @since 0.9.1, public since 0.9.27
     94     */
     95    public static File wrapperLogFile(I2PAppContext ctx) {
    9496        File f = null;
    9597        if (ctx.hasWrapper()) {
     
    130132        } else {
    131133            str = str.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;");
    132             return "<p>" + _t("File location") + ": <b><code>" + f.getAbsolutePath() + "</code></b></p><pre>" + str + "</pre>";
     134            return "<p>" + _t("File location") + ": <a href=\"/wrapper.log\">" + f.getAbsolutePath() + "</a></p><pre>" + str + "</pre>";
    133135        }
    134136    }
  • apps/routerconsole/jsp/viewhistory.jsp

    rb0789d4 rafa5a19  
    1 <%
     1<%@page pageEncoding="UTF-8"%><%
    22/*
    33 * USE CAUTION WHEN EDITING
     
    99response.setContentType("text/plain");
    1010response.setHeader("X-Content-Type-Options", "nosniff");
     11response.setDateHeader("Expires", 0);
     12response.addHeader("Cache-Control", "no-store, max-age=0, no-cache, must-revalidate");
     13response.addHeader("Pragma", "no-cache");
    1114String base = net.i2p.I2PAppContext.getGlobalContext().getBaseDir().getAbsolutePath();
    1215try {
  • apps/routerconsole/jsp/web.xml

    rb0789d4 rafa5a19  
    4444    </servlet-mapping>
    4545   
     46    <servlet-mapping>
     47      <servlet-name>net.i2p.router.web.jsp.viewrouterlog_jsp</servlet-name>
     48      <url-pattern>/router.log</url-pattern>
     49    </servlet-mapping>
     50   
     51    <servlet-mapping>
     52      <servlet-name>net.i2p.router.web.jsp.viewwrapperlog_jsp</servlet-name>
     53      <url-pattern>/wrapper.log</url-pattern>
     54    </servlet-mapping>
     55   
    4656    <session-config>
    4757        <session-timeout>
  • core/java/src/net/i2p/util/FileLogWriter.java

    rb0789d4 rafa5a19  
    3838    /**
    3939     *  File may not exist or have old logs in it if not opened yet
     40     *  @return non-null
    4041     */
    4142    public synchronized String currentFile() {
  • core/java/src/net/i2p/util/LogManager.java

    rb0789d4 rafa5a19  
    265265    }
    266266
     267    /**
     268     *  File may not exist or have old logs in it if not opened yet
     269     *  @return non-null
     270     */
    267271    public String currentFile() {
    268272        if (_writer == null)
  • core/java/src/net/i2p/util/LogWriter.java

    rb0789d4 rafa5a19  
    3838    }
    3939
     40    /**
     41     *  File may not exist or have old logs in it if not opened yet
     42     *  @return non-null
     43     */
    4044    public abstract String currentFile();
     45
    4146    /**
    4247     * Write the provided LogRecord to the writer.
Note: See TracChangeset for help on using the changeset viewer.