private void notice( final String msg, final Object... args ) { if( log != null ) { log.info( msg, args ); } }
protected final void info( final String msg, final Object... args ) { if( log != null ) { log.info( message, args ); } }
protected final void info( final String msg, final Object... args ) { if( log != null ) { log.info( msg, args ); } }
/** * Identical to File.mkdir() but will log if the logger is not null * @param dir Directory to make * @param log Log to use if not null * @return dir */ public static File mkdirs( final File dir, final Log log ) { if( dir != null && dir.mkdirs() && log != null ) { log.info( "Created %s", dir.getPath() ); } return dir; }
/** * Identical to File.mkdir() but will log if the logger is not null * @param dir Directory to make * @param log Log to use if not null * @return dir */ public static File mkdir( final File dir, final Log log ) { if( dir.mkdir() && log != null ) { log.info( "Created %s", dir.getPath() ); } return dir; }
public StaticFileHandler( final File rootDirectory ) { this.rootDirectory = rootDirectory; getLog().info( "Created StaticHandler for %s", rootDirectory.getAbsolutePath() ); }
/** * Delete a File. This is the same as {@link File#delete()} except that * this method will delete all content if it's a directory * * @param file File to delete * @param log Log to log progress to, null for no logging * @return true only if the file was really deleted */ public static boolean delete( @Nonnull final File file, @Nullable final Log log ) { if( file.exists() && file.isDirectory() ) { for( File child : file.listFiles() ) { delete( child, log ); } } if( log != null ) { log.info( "Deleting %s", file.getAbsolutePath() ); } return file.delete(); } }
/** * {@inheritDoc } */ @Override @SuppressWarnings( "unchecked" ) public Object postProcessAfterInitialization( final Object o, final String string ) throws BeansException { final Class clazz = o.getClass(); if( ResourceConfig.isProviderClass( clazz ) ) { log.info( "Registering bean %s of type %s as a provider class", string, clazz.getName() ); classes.add( clazz ); } else if( ResourceConfig.isRootResourceClass( clazz ) ) { log.info( "Registering bean %s of type %s as a root resource class", string, clazz.getName() ); classes.add( clazz ); } return o; } }
public final void bind( SocketAddress endPoint ) throws IOException { // If no endPoint is provided, then get a non-local IPV4 address if( endPoint == null ) { endPoint = new InetSocketAddress( getLocalInetAddress(), 0 ); } // Create the channel and bind the associated socket to the endPoint serverChannel = ServerSocketChannel.open(); serverChannel.configureBlocking( false ); serverSocket = serverChannel.socket(); serverSocket.bind( endPoint ); // Show the banner in the logs, will contain the IP, port and interface networkInterface = NetworkInterface.getByInetAddress( serverSocket.getInetAddress() ); getLog().info( "\n" + "----------------------------------------------------------------------\n" + "%s: %s|%d on %s\n" + "----------------------------------------------------------------------", getClass().getSimpleName(), serverSocket.getInetAddress().getHostAddress(), serverSocket.getLocalPort(), networkInterface == null ? "Unknown" : networkInterface.getName() ); getLog().info( "Now receiving accept" ); }
@Override public void read( final SocketChannel channel, final ByteBuffer buffer ) throws IOException { try { getLog().info( "A %d %d", buffer.position(), buffer.limit() ); getXMLStreamReader( buffer ); getLog().info( "B %d %d", buffer.position(), buffer.limit() ); do { while( xmlStreamReader.hasNext() ) { getLog().info( "C %d %d", buffer.position(), buffer.limit() ); parser.processEvents( xmlStreamReader ); } getLog().info( "D %d %d", buffer.position(), buffer.limit() ); } while( inputStream.available() > 0 ); getLog().info( "E %d %d", buffer.position(), buffer.limit() ); } catch( XMLStreamException ex ) { parser.notifyStreamError( ex ); throw new IOException( ex ); } }
@Override public <T> XMPPLogic process( @Nonnull final XMPPServer<T> server, @Nonnull final MucService service, @Nullable final MucRoom room, @Nonnull final Presence<?, ?> presence ) throws MessageException { // This is the departing users room jid final JID jidInRoom = presence.getTo(); getLog().info( "%s left %s", presence.getFrom(), jidInRoom ); // Remove the user from the room final MucRoomMember leavingMember = room.remove( jidInRoom ); // now send the relevant messages return roomLeaveBroadcast( server, service, room, presence, jidInRoom, leavingMember ); }
getLog().info( "Removing HttpContext %s on HttpServer %s", path, httpServer.getAddress() );
@Override public void closing( final SocketChannel channel ) { if( parser != null ) { parser.notifyStreamClosed(); parser.removeListener( this ); parser = null; } if( xmlStreamReader != null ) { try { xmlStreamReader.close(); } catch( XMLStreamException ex ) { getLog().info( "Exception closing XMLStreamParser", ex ); } xmlStreamReader = null; } super.closing( channel ); }
@Override public void logMessage( final MucRoom room, final Message message ) { if( log.isInfoEnabled() ) { // FIXME figure out why this is needed @SuppressWarnings( "unchecked" ) final List<Body> body = message.getBody(); if( body.isEmpty() ) { log.info( "%s %s NO_BODY", message.getFrom(), room.getJid() ); } else { for( Body b : body ) { log.info( "%s %s %s", message.getFrom(), room.getJid(), b.getValue() ); } } } } };
@Override protected void consumePresence( Presence presence ) throws MessageException { getLog().info( "Presence %s from %s to %s type %s", presence.getId(), presence.getFrom(), presence.getTo(), presence.getType() ); } }
@Override protected void consumeIq( Iq iq ) throws MessageException { getLog().info( "Iq %s from %s to %s type %s", iq.getId(), iq.getFrom(), iq.getTo(), iq.getType() ); }
@Override protected void consumeMessage( Message message ) throws MessageException { getLog().info( "Message %s from %s to %s type %s", message.getId(), message.getFrom(), message.getTo(), message.getType() ); }
@WriteLock private void registerMacro( final MacroVisitor macro, final boolean throwException ) throws MacroAlreadyRegisteredException { final Macro annotation = getAnnotation( macro ); if( macros.containsKey( annotation.name() ) ) { if( throwException ) { throw new MacroAlreadyRegisteredException( annotation ); } } else { macros.put( annotation.name(), macro ); getLog().info( "Registered macro %s [%s]", annotation.name(), macro ); } }
/** * {@inheritDoc} */ @Override public void logMessage( final MucRoom room, final Message message ) { if( getLog().isInfoEnabled() ) { // FIXME another unchecked cast to investigate @SuppressWarnings( "unchecked" ) final List<Body> body = message.getBody(); if( body.isEmpty() ) { getLog().info( "%s %s NO_BODY", message.getFrom(), room.getJid() ); } else { for( Body b : body ) { getLog().info( "%s %s %s", message.getFrom(), room.getJid(), b.getValue() ); } } } } }
getLog().info( "%s: %s %s", exchange.getHttpContext().getPath(), method, exchange.getRequestURI() );