APISonar


net.i2p.util.Log.log

> net > i2p > util > Log > log
net APIs i2p APIs util APIs Log APIs log APIs

Example 1
private final static Log log = new Log(TrayManager.class);

    protected void startManager() {
        if(SystemTray.isSupported()) {
            tray = SystemTray.getSystemTray();
            trayIcon = new TrayIcon(getTrayImage(), "I2P", getMainMenu());
            trayIcon.setImageAutoSize(true); //Resize image to fit the system tray
            try {
                tray.add(trayIcon);
            } catch (AWTException e) {
                log.log(Log.WARN, "Problem creating system tray icon!", e);
            }
        }
    }
Example 2
private static Log _log;

    private void verifyNotReleased() {
        if (CACHE) return;
        if (_released) {
            _log.log(Log.CRIT, "Already released.  current stack trace is:", new Exception());
            _log.log(Log.CRIT, "Released by: ", _releasedBy);
            _log.log(Log.CRIT, "Acquired by: ", _acquiredBy);
        }
    }
Example 3
private final Log log;

    private void launchBrowser() {
        // null args ok
        UrlLauncher launcher = new UrlLauncher(_context, null, null);
        String url = _context.portMapper().getConsoleURL();
        try {
            launcher.openUrl(url);
        } catch (IOException e1) {
            log.log(Log.WARN, "Failed to open browser!", e1);
        }    
    }
Example 4
private Log _log;

    public void run() {
        while (true) {
            try {
                loop();
            } catch (Exception e) {
                _log.log(Log.CRIT, "wtf, establisher b0rked.  send this stack trace to jrandom", e);
            }
        }
    }
Example 5
private Log _log;

    public void rebuildNewIdentity() {
        killKeys();
        try {
            for (Iterator iter = _shutdownTasks.iterator(); iter.hasNext(); ) {
                Runnable task = (Runnable)iter.next();
                task.run();
            }
        } catch (Throwable t) {
            _log.log(Log.CRIT, "Error running shutdown task", t);
        }
        // hard and ugly
        finalShutdown(EXIT_HARD_RESTART);
    }
Example 6
public static void start() {
        try {
            //TODO: set/get PID
            String separator = System.getProperty("file.separator");
            String location = getAppContext().getBaseDir().getAbsolutePath();
            String[] args = new String[] { location + separator + "i2psvc", location + separator + "wrapper.config" };
            Runtime.getRuntime().exec(args);
        } catch (IOException e) {
            Log log = getAppContext().logManager().getLog(RouterManager.class);
            log.log(Log.WARN, "Failed to start I2P", e);
        }
    }
Example 7
protected Log _log;

    public String getMessages() {
        if (_group == null)
            return "";
        
        StringBuffer buf = new StringBuffer(512);
        if (_action != null) {
            try {
                buf.append(processAction()).append("\n");
            } catch (Exception e) {
                _log.log(Log.CRIT, "Error processing " + _action, e);
            }
        }
        getMessages(_group.clearAllMessages(), buf);
        return buf.toString();
    }
Example 8
private final Log _log;

    private void allocate(List<File> files) {
        int maxSize = 0;
        for (File f : files) {
            maxSize += getSize(f);
        }
        try {
            _blocklist = new long[maxSize + files.size()];  // extra for wrapsave
        } catch (OutOfMemoryError oom) {
            _log.log(Log.CRIT, "OOM creating the blocklist");
            disable();
        }
    }
Example 9
private static void log(I2PAppContext ctx, int level, String msg, Throwable t) {
        Log l = ctx.logManager().getLog(CertUtil.class);
        l.log(level, msg, t);
    }
Example 10
private Log _log;

    public void finalShutdown(int exitCode) {
        _log.log(Log.CRIT, "Shutdown(" + exitCode + ") complete", new Exception("Shutdown"));
        try { _context.logManager().shutdown(); } catch (Throwable t) { }
        if (ALLOW_DYNAMIC_KEYS) {
            if ("true".equalsIgnoreCase(_context.getProperty(PROP_DYNAMIC_KEYS, "false")))
                killKeys();
        }

        File f = new File(getPingFile());
        f.delete();
        if (_killVMOnEnd) {
            try { Thread.sleep(1000); } catch (InterruptedException ie) {}
            Runtime.getRuntime().halt(exitCode);
        }
    }
Example 11
private final Log _log;

    public synchronized void startPumping() {
        if (_log.shouldLog(Log.INFO))
            _log.info("Starting pumper");
        try {
            _selector = Selector.open();
            _alive = true;
            new I2PThread(this, "NTCP Pumper", true).start();
        } catch (IOException ioe) {
            _log.log(Log.CRIT, "Error opening the NTCP selector", ioe);
        } catch (java.lang.InternalError jlie) {
            // "unable to get address of epoll functions, pre-2.6 kernel?"
            _log.log(Log.CRIT, "Error opening the NTCP selector", jlie);
        }
    }
Example 12
private final Log _log;

    public void run() {
        _isRunning = true;
        while (_isRunning && !_manager.isShutdown()) {
            try {
                handleInboundRequest();
            } catch (RuntimeException e) {
                _log.log(Log.CRIT, "B0rked in the tunnel handler", e);
            }
        }
        if (_log.shouldLog(Log.WARN))
            _log.warn("Done handling");
        _isRunning = false;
    }
Example 13
public void timeReached() {
        try {
            _context.netDb().publish(_context.router().getRouterInfo());
        } catch (IllegalArgumentException iae) {
            Log log = _context.logManager().getLog(Router.class);
            log.log(Log.CRIT, "Local router info is invalid?  rebuilding a new identity", iae);
            _context.router().rebuildNewIdentity();
        }
    }
Example 14
private Log _log;

    void shutdown() {
        StringBuffer buf = new StringBuffer(1024);
        buf.append("Validated messages: ").append(_receivedIds.size());
        _log.log(Log.CRIT, buf.toString());
    }
Example 15
private final static Log _log = new Log(I2PSocketImpl.class);

    public void queueData(byte[] data) {
        _bytesRead += data.length;
        try {
            in.queueData(data, false);
        } catch (IOException ioe) {
            _log.log(Log.CRIT, "wtf, we said DONT block, how can we timeout?", ioe);
        }
    }
Example 16
private Log _log;

    private void setTime(String cmd) {
        int start = cmd.indexOf("now=");
        String str = cmd.substring(start + 4, start+4+FORMAT_STRING.length());
        try {
            long now = getTime(str);
            if (_log.shouldLog(Log.INFO))
                _log.log(Log.INFO, "Admin time set to " + str);
            setTime(now);
        } catch (ParseException pe) {
            _log.error("Invalid time specified [" + str + "]", pe);
        }
    }
Example 17
private final Log _log;

    public void fail(UDPEndpoint endpoint) {
        if (_endpoints.remove(endpoint)) {
            _log.log(Log.CRIT, "UDP port failure: " + endpoint);
            if (_endpoints.isEmpty()) {
                _log.log(Log.CRIT, "No more UDP sockets open");
                setReachabilityStatus(CommSystemFacade.STATUS_HOSED);
                // TODO restart?
            }
            rebuildExternalAddress();
        }
    }
Example 18
private Log _log;

    public boolean initialize(OutNetMessage msg) {
        if (msg == null) return false;
        try {
            return initialize(msg, msg.getMessage(), null);
        } catch (OutOfMemoryError oom) {
            throw oom;
        } catch (Exception e) {
            _log.log(Log.CRIT, "Error initializing " + msg, e);
            return false;
        }
    }
Example 19
private Log _log;

    void disconnectClient(String reason) {
        if (_log.shouldLog(Log.CRIT))
            _log.log(Log.CRIT, "Disconnecting the client (" 
                     + _config
                     + ": " + reason);
        DisconnectMessage msg = new DisconnectMessage();
        msg.setReason(reason);
        try {
            doSend(msg);
        } catch (I2CPMessageException ime) {
            _log.error("Error writing out the disconnect message: " + ime);
        }
        stopRunning();
    }
Example 20
private Log _log;

    public final void encryptBlock(byte payload[], int inIndex, SessionKey sessionKey, byte out[], int outIndex) {
        if (sessionKey.getPreparedKey() == null) {
            try {
                Object key = CryptixRijndael_Algorithm.makeKey(sessionKey.getData(), 16);
                sessionKey.setPreparedKey(key);
            } catch (InvalidKeyException ike) {
                _log.log(Log.CRIT, "Invalid key", ike);
                throw new IllegalArgumentException("wtf, invalid key?  " + ike.getMessage());
            }
        }
        
        CryptixRijndael_Algorithm.blockEncrypt(payload, out, inIndex, outIndex, sessionKey.getPreparedKey(), 16);
    }
Example 21
private Log _log;

    public void run() {
        while (_alive) {
            try {
                UDPPacket packets[] = _fragments.getNextVolley();
                if (packets != null) {
                    for (int i = 0; i < packets.length; i++) {
                        if (packets[i] != null) // null for ACKed fragments
                            _sender.add(packets[i], 0); // 0 does not block //100); // blocks for up to 100ms
                    }
                }
            } catch (Exception e) {
                _log.log(Log.CRIT, "Error pushing", e);
            }
        }
    }
Example 22
private final static Log _log = new Log(SimpleStatDumper.class);

    public static void dumpStats(I2PAppContext context, int logLevel) {
        if (!_log.shouldLog(logLevel)) return;

        StringBuilder buf = new StringBuilder(4 * 1024);
        dumpFrequencies(context, buf);
        dumpRates(context, buf);
        _log.log(logLevel, buf.toString());
    }
Example 23
private Log _log;

    public DummyElGamalEngine(I2PAppContext context) {
        super(context);
        _log = context.logManager().getLog(DummyElGamalEngine.class);
        _log.log(Log.CRIT, "Dummy ElGamal engine in use!  NO DATA SECURITY.  Danger Will Robinson, Danger!",
                 new Exception("I really hope you know what you're doing"));
    }
Example 24
protected transient final Log _log;

    protected void setResourceBase(File base) throws UnavailableException {
        if (!base.isDirectory()) {
            _log.log(Log.CRIT, "Configured i2psnark directory " + base + " does not exist");
            throw new UnavailableException("Resource base does not exist: " + base);
        }
        _resourceBase = base;
        if (_log.shouldLog(Log.INFO))
            _log.info("Resource base is " + _resourceBase);
    }
Example 25
private Log _log;

    public void startup() {
        if (_log.shouldLog(Log.DEBUG))
            _log.debug("Starting up the UDP endpoint");
        shutdown();
        _socket = getSocket();
        if (_socket == null) {
            _log.log(Log.CRIT, "UDP Unable to open a port");
            return;
        }
        _sender = new UDPSender(_context, _socket, "UDPSender");
        _receiver = new UDPReceiver(_context, _transport, _socket, "UDPReceiver");
        _sender.startup();
        _receiver.startup();
    }