/** If <code>assertion</code> parameter is <code>false</code>, then logs <code>msg</code> as an {@link #error(Object) error} statement. <p>The <code>assert</code> method has been renamed to <code>assertLog</code> because <code>assert</code> is a language reserved word in JDK 1.4. @param assertion @param msg The message to print if <code>assertion</code> is false. @since 1.2 */ public void assertLog(boolean assertion, String msg) { if(!assertion) this.error(msg); }
public void assertLog(boolean assertion, String msg) { if (!assertion) error(msg); }
/** Returns the string resource coresponding to <code>key</code> in this category's inherited resource bundle. See also {@link #getResourceBundle}. <p>If the resource cannot be found, then an {@link #error error} message will be logged complaining about the missing resource. */ protected String getResourceBundleString(String key) { ResourceBundle rb = getResourceBundle(); // This is one of the rare cases where we can use logging in order // to report errors from within log4j. if(rb == null) { //if(!hierarchy.emittedNoResourceBundleWarning) { //error("No resource bundle has been set for category "+name); //hierarchy.emittedNoResourceBundleWarning = true; //} return null; } else { try { return rb.getString(key); } catch(MissingResourceException mre) { error("No resource is associated with key \""+key+"\"."); return null; } } }
/** If <code>assertion</code> parameter is <code>false</code>, then logs <code>msg</code> as an {@link #error(Object) error} statement. <p>The <code>assert</code> method has been renamed to <code>assertLog</code> because <code>assert</code> is a language reserved word in JDK 1.4. @param assertion @param msg The message to print if <code>assertion</code> is false. @since 1.2 */ public void assertLog(boolean assertion, String msg) { if(!assertion) this.error(msg); }
/** If <code>assertion</code> parameter is <code>false</code>, then logs <code>msg</code> as an {@link #error(Object) error} statement. <p>The <code>assert</code> method has been renamed to <code>assertLog</code> because <code>assert</code> is a language reserved word in JDK 1.4. @param assertion @param msg The message to print if <code>assertion</code> is false. @since 1.2 */ public void assertLog(boolean assertion, String msg) { if(!assertion) { this.error(msg); } }
public SocketNode(Socket socket, LoggerRepository hierarchy) { this.socket = socket; this.hierarchy = hierarchy; try { ois = new ObjectInputStream( new BufferedInputStream(socket.getInputStream())); } catch(Exception e) { logger.error("Could not open ObjectInputStream to "+socket, e); } }
/** Returns the string resource coresponding to <code>key</code> in this category's inherited resource bundle. See also {@link #getResourceBundle}. <p>If the resource cannot be found, then an {@link #error error} message will be logged complaining about the missing resource. */ protected String getResourceBundleString(String key) { ResourceBundle rb = getResourceBundle(); // This is one of the rare cases where we can use logging in order // to report errors from within log4j. if(rb == null) { //if(!hierarchy.emittedNoResourceBundleWarning) { //error("No resource bundle has been set for category "+name); //hierarchy.emittedNoResourceBundleWarning = true; //} return null; } else { try { return rb.getString(key); } catch(MissingResourceException mre) { error("No resource is associated with key \""+key+"\"."); return null; } } }
static void roll() { try { Socket socket = new Socket(host, port); DataOutputStream dos = new DataOutputStream(socket.getOutputStream()); DataInputStream dis = new DataInputStream(socket.getInputStream()); dos.writeUTF(ExternallyRolledFileAppender.ROLL_OVER); String rc = dis.readUTF(); if(ExternallyRolledFileAppender.OK.equals(rc)) { cat.info("Roll over signal acknowledged by remote appender."); } else { cat.warn("Unexpected return code "+rc+" from remote entity."); System.exit(2); } } catch(IOException e) { cat.error("Could not send roll signal on host "+host+" port "+port+" .", e); System.exit(2); } System.exit(0); } }
/** Returns the string resource coresponding to <code>key</code> in this category's inherited resource bundle. See also {@link #getResourceBundle}. <p>If the resource cannot be found, then an {@link #error error} message will be logged complaining about the missing resource. */ protected String getResourceBundleString(String key) { ResourceBundle rb = getResourceBundle(); // This is one of the rare cases where we can use logging in order // to report errors from within log4j. if(rb == null) { //if(!hierarchy.emittedNoResourceBundleWarning) { //error("No resource bundle has been set for category "+name); //hierarchy.emittedNoResourceBundleWarning = true; //} return null; } else { try { return rb.getString(key); } catch(MissingResourceException mre) { error("No resource is associated with key \""+key+"\"."); return null; } } }
/** Listens for client connections **/ public void run() { LOG.info("Thread started"); try { while (true) { LOG.debug("Waiting for a connection"); final Socket client = mSvrSock.accept(); LOG.debug("Got a connection from " + client.getInetAddress().getHostName()); final Thread t = new Thread(new Slurper(client)); t.setDaemon(true); t.start(); } } catch (IOException e) { LOG.error("Error in accepting connections, stopping.", e); } } }
logger.info("Closing connection."); } catch(Exception e) { logger.error("Unexpected exception. Closing conneciton.", e);
protected static Object lookup(Context ctx, String name) throws NamingException { try { return ctx.lookup(name); } catch(NameNotFoundException e) { logger.error("Could not find name ["+name+"]."); throw e; } }
protected static Object lookup(Context ctx, String name) throws NamingException { try { return ctx.lookup(name); } catch(NameNotFoundException e) { logger.error("Could not find name ["+name+"]."); throw e; } }
protected static Object lookup(Context ctx, String name) throws NamingException { try { return ctx.lookup(name); } catch(NameNotFoundException e) { logger.error("Could not find name ["+name+"]."); throw e; } }
private static String getText(ResourceBundle resourceBundle, String key) { try { return resourceBundle.getString(key); } catch (MissingResourceException e) { log.error(e); return ""; } }
protected static Object lookup(Context ctx, String name) throws NamingException { try { return ctx.lookup(name); } catch(NameNotFoundException e) { logger.error("Could not find name ["+name+"]."); throw e; } }
protected static Object lookup(Context ctx, String name) throws NamingException { try { return ctx.lookup(name); } catch(NameNotFoundException e) { logger.error("Could not find name ["+name+"]."); throw e; } }
public SocketNode(Socket socket, LoggerRepository hierarchy) { this.socket = socket; this.hierarchy = hierarchy; try { ois = new ObjectInputStream( new BufferedInputStream(socket.getInputStream())); } catch(Exception e) { logger.error("Could not open ObjectInputStream to "+socket, e); } }
public SocketNode(Socket socket, LoggerRepository hierarchy) { this.socket = socket; this.hierarchy = hierarchy; try { ois = new ObjectInputStream( new BufferedInputStream(socket.getInputStream())); } catch(Exception e) { logger.error("Could not open ObjectInputStream to "+socket, e); } }
public SocketNode(Socket socket, LoggerRepository hierarchy) { this.socket = socket; this.hierarchy = hierarchy; try { ois = new ObjectInputStream( new BufferedInputStream(socket.getInputStream())); } catch(Exception e) { logger.error("Could not open ObjectInputStream to "+socket, e); } }