-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add socket log appender, enable json format for it
- Loading branch information
Showing
16 changed files
with
514 additions
and
2 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
core/deployment/src/main/java/io/quarkus/deployment/builditem/LogSocketFormatBuildItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package io.quarkus.deployment.builditem; | ||
|
||
import java.util.Optional; | ||
import java.util.logging.Formatter; | ||
|
||
import org.wildfly.common.Assert; | ||
|
||
import io.quarkus.builder.item.MultiBuildItem; | ||
import io.quarkus.runtime.RuntimeValue; | ||
|
||
/** | ||
* The socket format build item. Producing this item will cause the logging subsystem to disregard its | ||
* socket logging formatting configuration and use the formatter provided instead. If multiple formatters | ||
* are enabled at runtime, a warning message is printed and only one is used. | ||
*/ | ||
public final class LogSocketFormatBuildItem extends MultiBuildItem { | ||
private final RuntimeValue<Optional<Formatter>> formatterValue; | ||
|
||
/** | ||
* Construct a new instance. | ||
* | ||
* @param formatterValue the optional formatter runtime value to use (must not be {@code null}) | ||
*/ | ||
public LogSocketFormatBuildItem(final RuntimeValue<Optional<Formatter>> formatterValue) { | ||
this.formatterValue = Assert.checkNotNullParam("formatterValue", formatterValue); | ||
} | ||
|
||
/** | ||
* Get the formatter value. | ||
* | ||
* @return the formatter value | ||
*/ | ||
public RuntimeValue<Optional<Formatter>> getFormatterValue() { | ||
return formatterValue; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
core/runtime/src/main/java/io/quarkus/runtime/logging/SocketConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package io.quarkus.runtime.logging; | ||
|
||
import java.net.InetSocketAddress; | ||
import java.util.Optional; | ||
import java.util.logging.Level; | ||
|
||
import org.jboss.logmanager.handlers.SocketHandler.Protocol; | ||
|
||
import io.quarkus.runtime.annotations.ConfigGroup; | ||
import io.quarkus.runtime.annotations.ConfigItem; | ||
|
||
@ConfigGroup | ||
public class SocketConfig { | ||
|
||
/** | ||
* If socket logging should be enabled | ||
*/ | ||
@ConfigItem | ||
boolean enable; | ||
|
||
/** | ||
* | ||
* The IP address and port of the server receiving the logs | ||
*/ | ||
@ConfigItem(defaultValue = "localhost:4560") | ||
InetSocketAddress endpoint; | ||
|
||
/** | ||
* Sets the protocol used to connect to the syslog server | ||
*/ | ||
@ConfigItem(defaultValue = "tcp") | ||
Protocol protocol; | ||
|
||
/** | ||
* Enables or disables blocking when attempting to reconnect a | ||
* {@link Protocol#TCP | ||
* TCP} or {@link Protocol#SSL_TCP SSL TCP} protocol | ||
*/ | ||
@ConfigItem | ||
boolean blockOnReconnect; | ||
|
||
/** | ||
* The log message format | ||
*/ | ||
@ConfigItem(defaultValue = "%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c{3.}] (%t) %s%e%n") | ||
String format; | ||
|
||
/** | ||
* The log level specifying, which message levels will be logged by socket logger | ||
*/ | ||
@ConfigItem(defaultValue = "ALL") | ||
Level level; | ||
|
||
/** | ||
* The name of the filter to link to the file handler. | ||
*/ | ||
@ConfigItem | ||
Optional<String> filter; | ||
|
||
/** | ||
* Socket async logging config | ||
*/ | ||
AsyncConfig async; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.