Skip to content

Commit

Permalink
Address code review comments in regards to log file name
Browse files Browse the repository at this point in the history
  • Loading branch information
sarxos committed Jun 5, 2019
1 parent a28d2af commit aab71c4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
@ConfigGroup
public class FileConfig {

/**
* Default file name where logs should be stored.
*/
public static final String DEFAULT_LOG_FILE_NAME = "quarkus.log";

/**
* If file logging should be enabled
*/
Expand All @@ -40,15 +45,15 @@ public class FileConfig {
String format;

/**
* The file log level
* The level of logs to be written into the file.
*/
@ConfigItem(defaultValue = "ALL")
Level level;

/**
* The file logging log level
* The name of the file in which logs will be written.
*/
@ConfigItem(defaultValue = "quarkus.log")
@ConfigItem(defaultValue = DEFAULT_LOG_FILE_NAME)
File path;

/**
Expand Down
14 changes: 7 additions & 7 deletions docs/src/main/asciidoc/extension-authors-guide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ import java.util.logging.Level;
public class FileConfig {
/**
* Enable logging to file.
* Enable logging to a file.
*/
@ConfigItem(defaultValue = "true")
boolean enable;
Expand All @@ -494,13 +494,13 @@ public class FileConfig {
String format;
/**
* The log level.
* The level of logs to be written into the file.
*/
@ConfigItem(defaultValue = "ALL")
Level level;
/**
* The file name where logs will be stored.
* The name of the file in which logs will be written.
*/
@ConfigItem(defaultValue = "application.log")
File path;
Expand Down Expand Up @@ -545,9 +545,9 @@ configuration object containing a collection of configurable properties, rather
key type.
<2> The `@ConfigRoot` annotation indicates that this object is a configuration root group, in this case one which
corresponds to a `log` segment. A class name is used to link configuration root group with the segment from a
property name. This class name is `LogConfiguration` so the `Configuration` part is stripped off, the remaining `Log`
is lowercased and becomes a `log`. Since all `@ConfigRoot` annotated classes uses `quarkus` as a prefix, this finally
becomes `quarkus.log` and represents a properties which names begins with `quarkus.log.*`.
property name. The `Configuration` part is stripped off from a `LogConfiguration` class name and the remaining `Log`
is lowercased to become a `log`. Since all `@ConfigRoot` annotated classes uses `quarkus` as a prefix, this finally
becomes `quarkus.log` and represents the properties which names begin with `quarkus.log.*`.
<3> Here the `LoggingProcessor` injects a `LogConfiguration` instance automatically by detecting the `@ConfigRoot`
annotation.

Expand All @@ -560,7 +560,7 @@ quarkus.log.file.level=DEBUG
quarkus.log.file.path=/tmp/debug.log
----

Since `format` is not defined in these properties, a default value from `@ConfigItem` will be used instead.
Since `format` is not defined in these properties, the default value from `@ConfigItem` will be used instead.

=== Bytecode Recording

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import java.nio.file.Files;
import java.nio.file.Paths;

import io.quarkus.runtime.logging.FileConfig;

public class PropertyTestUtil {

public static void setLogFileProperty() {
Expand All @@ -30,7 +32,7 @@ public static void setLogFileProperty(String logFileName) {
}

public static String getLogFileLocation() {
return getLogFileLocation("quarkus.log");
return getLogFileLocation(FileConfig.DEFAULT_LOG_FILE_NAME);
}

private static String getLogFileLocation(String logFileName) {
Expand Down

0 comments on commit aab71c4

Please sign in to comment.