io.vlingo.actors.Logger Java Examples
The following examples show how to use
io.vlingo.actors.Logger.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GridNodeBootstrap.java From vlingo-lattice with Mozilla Public License 2.0 | 6 votes |
public static GridNodeBootstrap boot(final GridRuntime grid, final String nodeName, final io.vlingo.cluster.model.Properties properties, final boolean embedded) throws Exception { properties.validateRequired(nodeName); final Tuple2<ClusterSnapshotControl, Logger> control = Cluster.controlFor( grid.world(), new GridNodeInstantiator(grid), properties, nodeName); final GridNodeBootstrap instance = new GridNodeBootstrap(control, nodeName); control._2.info("Successfully started cluster node: '" + nodeName + "'"); if (!embedded) { control._2.info("=========="); } return instance; }
Example #2
Source File: Slf4jLoggerPluginTest.java From vlingo-actors with Mozilla Public License 2.0 | 6 votes |
@Test public void testRegistration() { final Configuration configuration = Configuration.define(); final Slf4jLoggerPlugin plugin = new Slf4jLoggerPlugin(); plugin.configuration().buildWith(configuration, new PluginProperties("slf4jTestRegistration", new Properties())); plugin.start(registrar); assertTrue(registered); Logger logger = plugin.logger(); assertNotNull(logger); assertEquals("slf4jTestRegistration", plugin.name()); logger.debug("TEST:3 1"); logger.debug("TEST:3 2"); logger.debug("TEST:3 3"); }
Example #3
Source File: ClientConsumerCommons.java From vlingo-http with Mozilla Public License 2.0 | 6 votes |
/** * Answer a new ClientRequestResponseChannel from the {@code configuration}. * @param configuration the Configuration * @return ClientRequestResponseChannel * @throws Exception when the channel cannot be created */ static ClientRequestResponseChannel clientChannel( final Configuration configuration, final ResponseChannelConsumer consumer, final Logger logger) throws Exception { if (configuration.secure) { return new SecureClientRequestResponseChannel( configuration.addressOfHost, consumer, configuration.readBufferPoolSize, configuration.readBufferSize, logger); } else { return new NettyClientRequestResponseChannel( configuration.addressOfHost, consumer, configuration.readBufferPoolSize, configuration.readBufferSize); } }
Example #4
Source File: HttpAgent.java From vlingo-http with Mozilla Public License 2.0 | 6 votes |
public static HttpAgent initialize( final HttpRequestChannelConsumerProvider provider, final int port, final boolean useSSL, final int numberOfThreads, final Logger logger) throws Exception { final SslContext sslContext = useSSL ? sslContext() : null; final OptimalTransport optimalTransport = optimalTransport(logger); final EventLoopGroup bossGroup = eventLoopGroup(optimalTransport, numberOfThreads, logger); final EventLoopGroup workerGroup = eventLoopGroup(optimalTransport, logger); ServerBootstrap bootstrap = new ServerBootstrap() .group(bossGroup, workerGroup) .channel(serverSocketChannelType(optimalTransport, logger)) .handler(new LoggingHandler(LogLevel.INFO)) .childHandler(new AgentInitializer(provider, sslContext, logger)); return new HttpAgent(bootstrap.bind(port).sync().channel(), bossGroup, workerGroup); }
Example #5
Source File: Resources.java From vlingo-http with Mozilla Public License 2.0 | 6 votes |
/** * Dispatch the {@code Request} held by the {@code Context} and matching * one of my managed resource instances, or log a warning if no match. * Returns immediately following the non-blocking dispatch. * @param context the Context containing the Request to match * @param logger the Logger to log potential warnings and errors */ void dispatchMatching(final Context context, Logger logger) { String message; try { for (final Resource<?> resource : namedResources.values()) { final MatchResults matchResults = resource.matchWith(context.request.method, context.request.uri); if (matchResults.isMatched()) { final MappedParameters mappedParameters = matchResults.action.map(context.request, matchResults.parameters()); resource.dispatchToHandlerWith(context, mappedParameters); return; } } message = "No matching resource for method " + context.request.method + " and URI " + context.request.uri; logger.warn(message); } catch (Exception e) { message = "Problem dispatching request for method " + context.request.method + " and URI " + context.request.uri + " because: " + e.getMessage(); logger.error(message, e); } context.completes.with(Response.of(Response.Status.NotFound, message)); }
Example #6
Source File: HttpAgent.java From vlingo-http with Mozilla Public License 2.0 | 5 votes |
private static EventLoopGroup eventLoopGroup( final OptimalTransport optimalTransport, final int processorPoolSize, final Logger logger) { switch (optimalTransport) { case Epoll: logger.debug("HttpAgent using EpollEventLoopGroup " + processorPoolSize); return new EpollEventLoopGroup(processorPoolSize); case NIO: default: logger.debug("HttpAgent using NioEventLoopGroup " + processorPoolSize); return new NioEventLoopGroup(processorPoolSize); } }
Example #7
Source File: RequestHandler4.java From vlingo-http with Mozilla Public License 2.0 | 5 votes |
Completes<Response> execute(final Request request, final T param1, final R param2, final U param3, final I param4, final Logger logger) { final Supplier<Completes<Response>> exec = () -> executor.execute(request, param1, param2, param3, param4, mediaTypeMapper, errorHandler, logger); return runParamExecutor(executor, () -> RequestExecutor.executeRequest(exec, errorHandler, logger)); }
Example #8
Source File: RequestHandler4.java From vlingo-http with Mozilla Public License 2.0 | 5 votes |
Completes<Response> execute(final Request request, final T param1, final R param2, final U param3, final I param4, final MediaTypeMapper mediaTypeMapper, final ErrorHandler errorHandler, final Logger logger);
Example #9
Source File: RequestHandler4.java From vlingo-http with Mozilla Public License 2.0 | 5 votes |
@Override protected Completes<Response> execute(final Request request, final Action.MappedParameters mappedParameters, final Logger logger) { final T param1 = resolverParam1.apply(request, mappedParameters); final R param2 = resolverParam2.apply(request, mappedParameters); final U param3 = resolverParam3.apply(request, mappedParameters); final I param4 = resolverParam4.apply(request, mappedParameters); final Supplier<Completes<Response>> exec = () -> executor.execute(request, param1, param2, param3, param4, mediaTypeMapper, errorHandler, logger); return runParamExecutor(executor, () -> RequestExecutor.executeRequest(exec, errorHandler, logger)); }
Example #10
Source File: DynamicResource.java From vlingo-http with Mozilla Public License 2.0 | 5 votes |
@Override protected void log(final Logger logger) { logger.info("Resource: " + name); for (final Action action : actions) { logger.info("Action: id=" + action.id + ", method=" + action.method + ", uri=" + action.uri + ", to=" + action.to.signature()); } }
Example #11
Source File: ConfigurationResource.java From vlingo-http with Mozilla Public License 2.0 | 5 votes |
@Override protected void log(final Logger logger) { logger.info("Resource: " + name); for (final Action action : actions) { logger.info("Action: id=" + action.id + ", method=" + action.method + ", uri=" + action.uri + ", to=" + action.to.signature()); } }
Example #12
Source File: ResourceErrorProcessor.java From vlingo-http with Mozilla Public License 2.0 | 5 votes |
static Response resourceHandlerError(ErrorHandler errorHandler, Logger logger, Exception exception) { Response response; try { logger.error("Exception thrown by Resource execution", exception); response = (errorHandler != null) ? errorHandler.handle(exception) : DefaultErrorHandler.instance().handle(exception); } catch (Exception errorHandlerException) { logger.error("Exception thrown by error handler when handling error", exception); response = defaultErrorResponse(); } return response; }
Example #13
Source File: RequestHandler3.java From vlingo-http with Mozilla Public License 2.0 | 5 votes |
@Override protected Completes<Response> execute(final Request request, final Action.MappedParameters mappedParameters, final Logger logger) { final T param1 = resolverParam1.apply(request, mappedParameters); final R param2 = resolverParam2.apply(request, mappedParameters); final U param3 = resolverParam3.apply(request, mappedParameters); final Supplier<Completes<Response>> exec = () -> executor.execute(request, param1, param2, param3, mediaTypeMapper, errorHandler, logger); return runParamExecutor(executor, () -> RequestExecutor.executeRequest(exec, errorHandler, logger)); }
Example #14
Source File: RequestHandler3.java From vlingo-http with Mozilla Public License 2.0 | 5 votes |
Completes<Response> execute(final Request request, final T param1, final R param2, final U param3, final MediaTypeMapper mediaTypeMapper, final ErrorHandler errorHandler, final Logger logger);
Example #15
Source File: HttpAgent.java From vlingo-http with Mozilla Public License 2.0 | 5 votes |
private static Class<? extends ServerSocketChannel> serverSocketChannelType( final OptimalTransport optimalTransport, final Logger logger) { switch (optimalTransport) { case Epoll: logger.debug("HttpAgent using EpollServerSocketChannel"); return EpollServerSocketChannel.class; case NIO: default: logger.debug("HttpAgent using NioServerSocketChannel"); return NioServerSocketChannel.class; } }
Example #16
Source File: HttpAgent.java From vlingo-http with Mozilla Public License 2.0 | 5 votes |
private static OptimalTransport optimalTransport(final Logger logger) { final String osName = System.getProperty("os.name"); logger.debug("HttpAgent running on " + osName); if (osName.toLowerCase().contains("linux")) { return OptimalTransport.Epoll; } return OptimalTransport.NIO; }
Example #17
Source File: HttpAgent.java From vlingo-http with Mozilla Public License 2.0 | 5 votes |
private static EventLoopGroup eventLoopGroup( final OptimalTransport optimalTransport, final Logger logger) { switch (optimalTransport) { case Epoll: logger.debug("HttpAgent using EpollEventLoopGroup"); return new EpollEventLoopGroup(); case NIO: default: logger.debug("HttpAgent using NioEventLoopGroup"); return new NioEventLoopGroup(); } }
Example #18
Source File: RequestObjectExecutor.java From vlingo-http with Mozilla Public License 2.0 | 5 votes |
static <O> Completes<Response> executeRequest(final Request request, final MediaTypeMapper mediaTypeMapper, final Supplier<Completes<ObjectResponse<O>>> executeAction, final ErrorHandler errorHandler, final Logger logger) { try { return executeAction.get() .andFinally(objectResponse -> toResponse(objectResponse, request, mediaTypeMapper, errorHandler, logger)); } catch(Exception ex) { return Completes.withFailure( ResourceErrorProcessor.resourceHandlerError(errorHandler, logger, ex)); } }
Example #19
Source File: RequestHandler5.java From vlingo-http with Mozilla Public License 2.0 | 5 votes |
Completes<Response> execute(final Request request, final T param1, final R param2, final U param3, final I param4, final J param5, final Logger logger) { final Supplier<Completes<Response>> exec = () -> executor.execute(request, param1, param2, param3, param4, param5, mediaTypeMapper, errorHandler, logger); return runParamExecutor(executor, () -> RequestExecutor.executeRequest(exec, errorHandler, logger)); }
Example #20
Source File: RequestHandler5.java From vlingo-http with Mozilla Public License 2.0 | 5 votes |
Completes<Response> execute(final Request request, final T param1, final R param2, final U param3, final I param4, final J param5, final MediaTypeMapper mediaTypeMapper, final ErrorHandler errorHandler, final Logger logger);
Example #21
Source File: Slf4jLoggerPluginTest.java From vlingo-actors with Mozilla Public License 2.0 | 5 votes |
@Test public void testStandardLogger() { Logger logger = LoggerProvider.standardLoggerProvider(world, "testStandardLogger").logger(); assertNotNull(logger); assertEquals("testStandardLogger", logger.name()); logger.trace("TRACE message"); logger.trace("TRACE message with parameters {}", "1"); logger.trace("TRACE message with exception", new Exception("test trace exception")); logger.trace("TRACE message with parameter {} and exception", 1, new Exception("test trace exception")); logger.debug("DEBUG message"); logger.debug("DEBUG message with parameters {}", "2"); logger.debug("DEBUG message with exception", new Exception("test debug exception")); logger.debug("DEBUG message with parameter {} and exception", 2, new Exception("test debug exception")); logger.info("INFO message"); logger.info("INFO message with parameters {}", "3"); logger.info("INFO message with exception", new Exception("test info exception")); logger.info("INFO message with parameter {} and exception", 3, new Exception("test info exception")); logger.warn("WARN message"); logger.warn("WARN message with parameters {}", "4"); logger.warn("WARN message with exception", new Exception("test warn exception")); logger.warn("WARN message with parameter {} and exception", 4, new Exception("test warn exception")); logger.error("ERROR message"); logger.error("ERROR message with parameters {}", "5"); logger.error("ERROR message with exception", new Exception("test error exception")); logger.error("ERROR message with parameter {} and exception", 5, new Exception("test error exception")); }
Example #22
Source File: RequestHandler6.java From vlingo-http with Mozilla Public License 2.0 | 5 votes |
@Override protected Completes<Response> execute(final Request request, final Action.MappedParameters mappedParameters, final Logger logger) { final T param1 = resolverParam1.apply(request, mappedParameters); final R param2 = resolverParam2.apply(request, mappedParameters); final U param3 = resolverParam3.apply(request, mappedParameters); final I param4 = resolverParam4.apply(request, mappedParameters); final J param5 = resolverParam5.apply(request, mappedParameters); final K param6 = resolverParam6.apply(request, mappedParameters); final Supplier<Completes<Response>> exec = () -> executor.execute(request, param1, param2, param3, param4, param5, param6, mediaTypeMapper, errorHandler, logger); return runParamExecutor(executor, () -> RequestExecutor.executeRequest(exec, errorHandler, logger)); }
Example #23
Source File: RequestHandler6.java From vlingo-http with Mozilla Public License 2.0 | 5 votes |
Completes<Response> execute(final Request request, final T param1, final R param2, final U param3, final I param4, final J param5, final K param6, final Logger logger) { final Supplier<Completes<Response>> exec = () -> executor.execute(request, param1, param2, param3, param4, param5, param6, mediaTypeMapper, errorHandler, logger); return runParamExecutor(executor, () -> RequestExecutor.executeRequest(exec, errorHandler, logger)); }
Example #24
Source File: RequestHandler0.java From vlingo-http with Mozilla Public License 2.0 | 5 votes |
@Override protected Completes<Response> execute(final Request request, final Action.MappedParameters mappedParameters, final Logger logger) { final Completes<Response> response = execute(request, logger); return response; }
Example #25
Source File: RequestHandler5.java From vlingo-http with Mozilla Public License 2.0 | 5 votes |
@Override protected Completes<Response> execute(final Request request, final Action.MappedParameters mappedParameters, final Logger logger) { final T param1 = resolverParam1.apply(request, mappedParameters); final R param2 = resolverParam2.apply(request, mappedParameters); final U param3 = resolverParam3.apply(request, mappedParameters); final I param4 = resolverParam4.apply(request, mappedParameters); final J param5 = resolverParam5.apply(request, mappedParameters); final Supplier<Completes<Response>> exec = () -> executor.execute(request, param1, param2, param3, param4, param5, mediaTypeMapper, errorHandler, logger); return runParamExecutor(executor, () -> RequestExecutor.executeRequest(exec, errorHandler, logger)); }
Example #26
Source File: RequestHandler6.java From vlingo-http with Mozilla Public License 2.0 | 5 votes |
Completes<Response> execute(final Request request, final T param1, final R param2, final U param3, final I param4, final J param5, final K param6, final MediaTypeMapper mediaTypeMapper, final ErrorHandler errorHandler, final Logger logger);
Example #27
Source File: RequestHandler2.java From vlingo-http with Mozilla Public License 2.0 | 5 votes |
@Override public Completes<Response> execute(final Request request, final Action.MappedParameters mappedParameters, final Logger logger) { final T param1 = resolverParam1.apply(request, mappedParameters); final R param2 = resolverParam2.apply(request, mappedParameters); return execute(request, param1, param2, logger); }
Example #28
Source File: RequestObjectExecutor.java From vlingo-http with Mozilla Public License 2.0 | 5 votes |
static <O> Response toResponse( final ObjectResponse<O> objectResponse, final Request request, final MediaTypeMapper mediaTypeMapper, final ErrorHandler errorHandler, final Logger logger) { return Success.of(objectResponse.responseFrom(request, mediaTypeMapper)) .resolve( ex -> ResourceErrorProcessor.resourceHandlerError(errorHandler, logger, (Exception) ex), response -> response); }
Example #29
Source File: RequestHandlerTest.java From vlingo-http with Mozilla Public License 2.0 | 4 votes |
@Override protected Completes<Response> execute(Request request, Action.MappedParameters mappedParameters, Logger logger) { return executor.execute(request, DefaultMediaTypeMapper.instance(), errorHandler, logger); }
Example #30
Source File: GridShutdownHook.java From vlingo-lattice with Mozilla Public License 2.0 | 4 votes |
protected GridShutdownHook(final String nodeName, final Tuple2<ClusterSnapshotControl, Logger> control) { this.nodeName = nodeName; this.control = control; }