Skip to content

Commit

Permalink
Adapt for quarkus 3.3+
Browse files Browse the repository at this point in the history
  • Loading branch information
manofthepeace committed Aug 30, 2023
1 parent d0160cf commit cdc16cf
Show file tree
Hide file tree
Showing 23 changed files with 149 additions and 598 deletions.
14 changes: 4 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ log level of your loggers.

| Endpoint | Http Method | Description |
| ------------- |:-------------:|:-----:|
| `/loggers` | `GET` | Returns the list of all loggers, with information about the configured and effective level |
| `/loggers?loggerName={loggerName}` | `GET` | Returns the logger specified by this name, with information about the configured and effective level |
| `/loggers` | `POST` | Changes the log level of the specified logger |
| `/loggers/levels` | `GET` | Get all the available level |
| `/logging-manager` | `GET` | Returns the list of all loggers, with information about the configured and effective level |
| `/logging-manager?loggerName={loggerName}` | `GET` | Returns the logger specified by this name, with information about the configured and effective level |
| `/logging-manager` | `POST` | Changes the log level of the specified logger |
| `/logging-manager/levels` | `GET` | Get all the available level |

## Security
Security of endpoints is important and we do not want to allow unknown people to know (or worse, change!) the log levels of
Expand Down Expand Up @@ -46,10 +46,6 @@ To use this in your application, simply add this in your pom.xml:

Note: Replace `${logger-manager.version}` with the latest version

Then browse to [http://localhost:8080/q/logging-manager-ui/](http://localhost:8080/q/logging-manager-ui/)

![logger_manager_log_screenshot](logstream.gif "Log stream Screenshot")

## OpenAPI

You can include the Logger Manager API in the OpenAPI document (and thus also Swagger UI). This needs to be
Expand All @@ -64,8 +60,6 @@ This will then add the following to your OpenAPI:
![swagger_manager screenshot](openapi.png "Swagger UI Screenshot")

## Roadmap
- [x] Add online log viewer option
- [x] Graphical UI to read logger level
- [x] OpenApiSpec for the endpoints
- [x] Make endpoint configurable
- [x] Enable customizable security on the endpoint (see readme file)
Expand Down
2 changes: 1 addition & 1 deletion deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.quarkiverse.loggingmanager</groupId>
<artifactId>quarkus-logging-manager-parent</artifactId>
<version>3.0.2-SNAPSHOT</version>
<version>3.1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.quarkiverse.loggingmanager.deployment;

import io.quarkus.runtime.annotations.ConfigDocSection;
import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigRoot;

Expand Down Expand Up @@ -31,17 +30,4 @@ public class LoggingManagerConfig {
*/
@ConfigItem(defaultValue = "true")
boolean alwaysInclude;

/**
* The number of history log entries to remember.
*/
@ConfigItem(defaultValue = "50")
public int historySize;

/**
* UI configuration
*/
@ConfigItem
@ConfigDocSection
LoggingManagerUIConfig ui;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import org.eclipse.microprofile.openapi.models.media.Schema;
import org.eclipse.microprofile.openapi.models.parameters.Parameter;

import io.quarkus.vertx.http.runtime.logstream.LogController;
import io.quarkiverse.loggingmanager.LogController;
import io.smallrye.openapi.api.models.media.SchemaImpl;

/**
Expand Down

Large diffs are not rendered by default.

This file was deleted.

This file was deleted.

This file was deleted.

11 changes: 0 additions & 11 deletions deployment/src/main/resources/dev-templates/embedded.html

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package io.quarkiverse.loggingmanager.deployment;

import static org.hamcrest.Matchers.containsString;

import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
Expand All @@ -16,11 +14,10 @@ public class CustomConfigTest {
@RegisterExtension
static final QuarkusUnitTest config = new QuarkusUnitTest()
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
.addAsResource(new StringAsset("quarkus.logging-manager.ui.root-path=custom"), "application.properties"));
.addAsResource(new StringAsset("quarkus.logging-manager.base-path=custom"), "application.properties"));

@Test
public void shouldUseCustomConfig() {
RestAssured.when().get("/q/custom").then().statusCode(200).body(containsString("Logging manager"));
RestAssured.when().get("/q/custom/index.html").then().statusCode(200).body(containsString("Logging manager"));
RestAssured.when().get("/q/custom").then().statusCode(200);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package io.quarkiverse.loggingmanager.deployment;

import static org.hamcrest.Matchers.containsString;

import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
Expand All @@ -20,8 +18,6 @@ public class CustomHttpRootTest {

@Test
public void shouldUseCustomConfig() {
RestAssured.when().get("/q/logging-manager-ui").then().statusCode(200).body(containsString("Logging manager"));
RestAssured.when().get("/q/logging-manager-ui/index.html").then().statusCode(200)
.body(containsString("Logging manager"));
RestAssured.when().get("/q/logging-manager").then().statusCode(200);
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.deployment.configuration.ConfigurationError;
import io.quarkus.runtime.configuration.ConfigurationException;
import io.quarkus.test.QuarkusUnitTest;

public class ErroneousConfigTest {

@RegisterExtension
static final QuarkusUnitTest config = new QuarkusUnitTest()
.setExpectedException(ConfigurationError.class)
.setExpectedException(ConfigurationException.class)
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
.addAsResource(new StringAsset("quarkus.logging-manager.ui.root-path=/\n"), "application.properties"));
.addAsResource(new StringAsset("quarkus.logging-manager.base-path=/\n"), "application.properties"));

@Test
public void shouldNotStartApplicationIfPathIsASlash() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package io.quarkiverse.loggingmanager.deployment;

import static org.hamcrest.Matchers.containsString;

import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.Test;
Expand All @@ -18,8 +16,6 @@ public class NoConfigTest {

@Test
public void shouldUseDefaultConfig() {
RestAssured.when().get("/q/logging-manager-ui").then().statusCode(200).body(containsString("Logging manager"));
RestAssured.when().get("/q/logging-manager-ui/index.html").then().statusCode(200)
.body(containsString("Logging manager"));
RestAssured.when().get("/q/logging-manager").then().statusCode(200);
}
}
}
Binary file removed logstream.gif
Binary file not shown.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<groupId>io.quarkiverse.loggingmanager</groupId>
<artifactId>quarkus-logging-manager-parent</artifactId>
<version>3.0.2-SNAPSHOT</version>
<version>3.1.0-SNAPSHOT</version>
<name>Quarkus - Logging Manager - Parent</name>

<packaging>pom</packaging>
Expand All @@ -22,7 +22,7 @@
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.release>11</maven.compiler.release>
<maven.compiler.parameters>true</maven.compiler.parameters>
<quarkus.version>3.2.4.Final</quarkus.version>
<quarkus.version>3.3.1</quarkus.version>
<compiler-plugin.version>3.11.0</compiler-plugin.version>
</properties>

Expand Down
2 changes: 1 addition & 1 deletion runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.quarkiverse.loggingmanager</groupId>
<artifactId>quarkus-logging-manager-parent</artifactId>
<version>3.0.2-SNAPSHOT</version>
<version>3.1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import static io.vertx.core.http.HttpMethod.GET;

import io.quarkus.vertx.http.runtime.logstream.LogController;
import io.vertx.core.Handler;
import io.vertx.core.http.HttpMethod;
import io.vertx.core.http.HttpServerRequest;
Expand Down
Loading

0 comments on commit cdc16cf

Please sign in to comment.