forked from I2P_Developers/i2p.i2p
Change default source logging from b64 to b32.
To change back to b64, add the following to the RequestLogImpl section of jetty.xml: <Set name="b64">true</Set>
This commit is contained in:
@ -31,12 +31,12 @@ public class I2PLogger implements Logger
|
||||
{
|
||||
private final Log _log;
|
||||
|
||||
StringBuilder _buffer = new StringBuilder();
|
||||
private final StringBuilder _buffer = new StringBuilder();
|
||||
|
||||
static {
|
||||
//static {
|
||||
// So people don't wonder where the logs went
|
||||
System.out.println("INFO: Jetty " + Server.getVersion() + " logging to I2P logs using class " + Server.class.getName());
|
||||
}
|
||||
//System.out.println("INFO: Jetty " + Server.getVersion() + " logging to I2P logs using class " + Server.class.getName());
|
||||
//}
|
||||
|
||||
public I2PLogger()
|
||||
{
|
||||
|
@ -76,6 +76,7 @@ public class I2PRequestLog extends AbstractLifeCycle implements RequestLog
|
||||
private boolean _logLatency = false;
|
||||
private boolean _logCookies = false;
|
||||
private boolean _logServer = false;
|
||||
private boolean _b64;
|
||||
|
||||
private transient OutputStream _out;
|
||||
private transient OutputStream _fileOut;
|
||||
@ -242,6 +243,15 @@ public class I2PRequestLog extends AbstractLifeCycle implements RequestLog
|
||||
_preferProxiedForAddress = preferProxiedForAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param b64 true to enable base 64 logging. False for base 32 logging. Default false.
|
||||
* @since 0.9.24
|
||||
*/
|
||||
public void setB64(boolean b64)
|
||||
{
|
||||
_b64 = b64;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public void log(Request request, Response response)
|
||||
{
|
||||
@ -280,11 +290,15 @@ public class I2PRequestLog extends AbstractLifeCycle implements RequestLog
|
||||
}
|
||||
|
||||
if (addr == null) {
|
||||
// TODO offer B32 option
|
||||
addr = request.getHeader("X-I2P-DestHash");
|
||||
if(addr != null)
|
||||
addr += ".i2p";
|
||||
else
|
||||
if (_b64) {
|
||||
addr = request.getHeader("X-I2P-DestHash");
|
||||
if (addr != null)
|
||||
addr += ".i2p";
|
||||
} else {
|
||||
// 52chars.b32.i2p
|
||||
addr = request.getHeader("X-I2P-DestB32");
|
||||
}
|
||||
if (addr == null)
|
||||
addr = request.getRemoteAddr();
|
||||
}
|
||||
|
||||
|
@ -310,6 +310,8 @@
|
||||
<Set name="extended">false</Set>
|
||||
<Set name="logCookies">false</Set>
|
||||
<Set name="LogTimeZone">GMT</Set>
|
||||
<!-- False for b32 logging. True for b64 logging. Default false -->
|
||||
<Set name="b64">false</Set>
|
||||
</New>
|
||||
</Set>
|
||||
</Ref>
|
||||
|
Reference in New Issue
Block a user