Giter Club home page Giter Club logo

vertx-web-accesslog's Issues

No license information

Hi Roman,

I am interesting in using vertx-web-accesslog but I notice that you have no licensing information.

If you agree would it be possible to get a standard MIT license or failing that an Apace license added to LICENSE.txt in the root folder ?

Many thanks

Sporadic initialization issues

Hello everyone,

Sometimes when deploying an vertx application (AWS ECS/Fargate) the initialization fails for on obvious reason.

hocon-config is pretty much similar to the one provided in this repos documentation:

configurations = [
  {
    identifier: accesslog-formatted
    logPattern: "%H cs-method \"cs-uri\" HTTP/sc-status took %Dms %Bbytes"
    appenders = [
      {
        appenderClassName: com.romanpierson.vertx.web.accesslogger.appender.logging.impl.LoggingAppender
        config {
          loggerName: accesslog
        }
      }
    ]
  }
]

Exception:

com.romanpierson.vertx.web.accesslogger.exception.AccessLoggerException: Unable to register access log configuration [accesslog-formatted]
	at com.romanpierson.vertx.web.accesslogger.impl.AccessLoggerHandlerImpl.lambda$new$0(AccessLoggerHandlerImpl.java:131)
	at io.vertx.core.impl.future.FutureImpl$3.onFailure(FutureImpl.java:153)
	at io.vertx.core.impl.future.FutureBase.emitFailure(FutureBase.java:75)
	at io.vertx.core.impl.future.FutureImpl.addListener(FutureImpl.java:191)
	at io.vertx.core.impl.future.PromiseImpl.addListener(PromiseImpl.java:23)
	at io.vertx.core.impl.future.FutureImpl.onComplete(FutureImpl.java:164)
	at io.vertx.core.impl.future.PromiseImpl.onComplete(PromiseImpl.java:23)
	at io.vertx.core.eventbus.EventBus.request(EventBus.java:107)
	at io.vertx.core.eventbus.EventBus.request(EventBus.java:85)
	at com.romanpierson.vertx.web.accesslogger.impl.AccessLoggerHandlerImpl.lambda$new$1(AccessLoggerHandlerImpl.java:98)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at com.romanpierson.vertx.web.accesslogger.impl.AccessLoggerHandlerImpl.<init>(AccessLoggerHandlerImpl.java:90)
	at com.romanpierson.vertx.web.accesslogger.AccessLoggerHandler.create(AccessLoggerHandler.java:39)
	at de.thisismana.VertexWithAccessLogs.lambda$start$2(VertexWithAccessLogs.java:66)
	at io.vertx.core.impl.future.FutureImpl$3.onSuccess(FutureImpl.java:141)
	at io.vertx.core.impl.future.FutureImpl$ListenerArray.onSuccess(FutureImpl.java:262)
	at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
	at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211)
	at io.vertx.core.impl.future.Mapping.onSuccess(Mapping.java:40)
	at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
	at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211)
	at io.vertx.core.impl.future.Mapping.onSuccess(Mapping.java:40)
	at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
	at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211)
	at io.vertx.core.impl.future.CompositeFutureImpl.trySucceed(CompositeFutureImpl.java:163)
	at io.vertx.core.impl.future.CompositeFutureImpl.lambda$all$0(CompositeFutureImpl.java:38)
	at io.vertx.core.impl.future.FutureImpl$3.onSuccess(FutureImpl.java:141)
	at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
	at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211)
	at io.vertx.core.impl.future.Composition$1.onSuccess(Composition.java:62)
	at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
	at io.vertx.core.impl.future.SucceededFuture.addListener(SucceededFuture.java:88)
	at io.vertx.core.impl.future.Composition.onSuccess(Composition.java:43)
	at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
	at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211)
	at io.vertx.core.impl.future.Composition$1.onSuccess(Composition.java:62)
	at io.vertx.core.impl.future.FutureImpl$ListenerArray.onSuccess(FutureImpl.java:262)
	at io.vertx.core.impl.future.FutureBase.lambda$emitSuccess$0(FutureBase.java:54)
	at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167)
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:569)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: (NO_HANDLERS,-1) No handlers for address accesslog.event.register
	at io.vertx.core.eventbus.impl.EventBusImpl.deliverMessageLocally(EventBusImpl.java:384)
	at io.vertx.core.eventbus.impl.EventBusImpl.sendLocally(EventBusImpl.java:341)
	at io.vertx.core.eventbus.impl.EventBusImpl.sendOrPub(EventBusImpl.java:329)
	at io.vertx.core.eventbus.impl.OutboundDeliveryContext.execute(OutboundDeliveryContext.java:109)
	at io.vertx.core.eventbus.impl.DeliveryContextBase.next(DeliveryContextBase.java:72)
	at io.vertx.core.eventbus.impl.OutboundDeliveryContext.next(OutboundDeliveryContext.java:28)
	at io.vertx.core.eventbus.impl.EventBusImpl.sendOrPubInternal(EventBusImpl.java:422)
	at io.vertx.core.eventbus.impl.EventBusImpl.sendOrPubInternal(EventBusImpl.java:428)
	at io.vertx.core.eventbus.impl.EventBusImpl.request(EventBusImpl.java:127)
	at io.vertx.core.eventbus.EventBus.request(EventBus.java:106)
	... 38 more

Usually a restart fixes things. But access logging will permanently fail for affected instances with the following error log:

[AccessLoggerHandlerImpl] Handler not ready to log due to missing registration(s)

The order of initialization is like this. So config should be ready at this point:

        ConfigStoreOptions store = new ConfigStoreOptions()
            .setType("file")
            .setFormat("hocon")
            .setConfig(new JsonObject().put("path", "application.conf"));

        ConfigRetriever retriever = ConfigRetriever.create(vertx,
            new ConfigRetrieverOptions().addStore(store));

        retriever.getConfig()
            .onFailure(log::error)
            .onComplete(json -> {
                var config = json.result();
                router.route().handler(AccessLoggerHandler.create(config));

Any idea what might cause this behavior (like a race condition)? Unfortunately, I'm quite new to vertx and cannot reproduce it on my machine nor when starting the very same docker image used on the production system.

NoSuchMethodError after creating singleton verticle log

Hi, I tried to follow your example to implement access logs on a vertix project and I have this error :

SEVERE: Unhandled exception
java.lang.NoSuchMethodError: io.vertx.core.Vertx.deployVerticle(Ljava/lang/String;Lio/vertx/core/DeploymentOptions;)Lio/vertx/core/Future;

I have added the yaml configuration you had in your readme like this :

public static void main(final String[] args) {
Launcher.executeCommand("run", MainVerticle.class.getName());

}

//@OverRide
public void start(Future startFuture) throws Exception {

JsonObject config= new JsonObject()
  .put("path", "src/main/conf/configuration.yaml");

ConfigStoreOptions store = new ConfigStoreOptions()
  .setType("file")
  .setFormat("yaml")
  .setConfig(config);

ConfigRetriever retriever = ConfigRetriever.create(vertx,
  new ConfigRetrieverOptions().addStore(store));



retriever.getConfig(json -> {
  JsonObject result = json.result();
  Router router = Router.router(vertx);
  router.route().handler(AccessLoggerHandler.create(result));
  HttpServer server = vertx.createHttpServer();

  server.requestHandler(request -> {

    // This handler gets called for each request that arrives on the server
    HttpServerResponse response = request.response();
    response.putHeader("content-type", "text/plain");

    // Write to the response and end it
    response.end("Hello World!");
  });

  server.listen(8080);
});

Thanks

New version for 3.5 vertx?

I noticed you made commits for 3.5 vertx, will that new version be published on bintray? Looks like the version on bintray is from before such changes

How do I use this?

  • Is this published on maven or some other artifact repository?
  • If so, how could I configure it as a dependency.

I looked at the build.gradle but it doesn't show any group:artifact:version info

PatternResolver fails to match all elements depending on order

I found an issue when re-ordering the elements in the log output pattern. If you change the logPattern in the server-config.yaml file to be "%m %D cs-uri" the example application crashes.

The issue appears to be caused by failing to resolve all the pattern elements in com.mdac.vertx.web.accesslogger.configuration.pattern.PatternResolver#resolvePattern. I've raised a pull request that adds a unit test and attempts to fix the issue by moving the offset check to only run if the extracted position is == to the previously found element.

I wasn't certain of the purpose of checking the offset, perhaps it can be ignored completely?

Happy to hear any comments.

Pull request: #10

1.0.0 incompatibility with Vertx 3.8.4 -- More inquiry than issue

Hey, thanks for creating the access logger handler.

This is more of an inquiry than an issue, but I've been using 1.0.0 for a long while now and I have seen no need to upgrade to the latest version yet. However, I've been looking to upgrade to Vertx 3.8.4 and in that version, they got rid of the io.vertx.ext.web.impl.Utils.createRFC1123DateTimeFormatter() method which is still used in a few places in the 1.0.0 version of this package. So I was thinking of upgrading to the latest version, but it seems to me that there are some pretty major changes that I am unsure if I want to take on i.e use of a worker verticle and event bus to facilitate logging.

Since I'm perfectly content with 1.0.0 except for the no longer valid method from Vertx Utils, I am tempted to fork the old version and replace the invalid method usage. But before I do that, I want to inquire if there are any stronger reasons why it would be good to use the latest version instead?

Thanks a lot!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.