How to enable "dev logging" in Javalin 5?

281 Views Asked by At

There have been a lot of changes to the configuration in Javalin 5. One thing that used to work in previous versions is to enable "dev logging":

var javalin = Javalin.create(cfg -> {
               cfg.enableDevLogging();
              }).start(8080);

But I cannot seem to find this setting in version 5. So the question is, how do you enable "dev logging" in Javalin version 5?

1

There are 1 best solutions below

0
On BEST ANSWER

You can enable this via 'DevLoggingPlugin'

Javalin.create(config -> {
    config.plugins.enableDevLogging(); // Approach 1
    config.plugins.register(new DevLoggingPlugin()); // Approach 2
});

NOTE: You * DO NOT * need to use both the lines in above config (Commented 'Approach 1' and 'Approach 2'). Just pick an approach that fits your style.

Refer to the Javalin docs for this plugin - https://javalin.io/plugins/devlogging