6
6
7
7
import io .quarkus .runtime .annotations .ConfigDocMapKey ;
8
8
import io .quarkus .runtime .annotations .ConfigDocSection ;
9
- import io .quarkus .runtime .annotations .ConfigItem ;
10
9
import io .quarkus .runtime .annotations .ConfigPhase ;
11
10
import io .quarkus .runtime .annotations .ConfigRoot ;
11
+ import io .smallrye .config .ConfigMapping ;
12
+ import io .smallrye .config .WithDefault ;
12
13
13
- @ ConfigRoot (phase = ConfigPhase .RUN_TIME , name = "log.handler.gelf" )
14
- public class GelfConfig {
14
+ @ ConfigMapping (prefix = "quarkus.log.handler.gelf" )
15
+ @ ConfigRoot (phase = ConfigPhase .RUN_TIME )
16
+ public interface GelfConfig {
15
17
/**
16
18
* Determine whether to enable the GELF logging handler
17
19
*/
18
- @ ConfigItem
19
- public boolean enabled ;
20
+ @ WithDefault ( "false" )
21
+ boolean enabled () ;
20
22
21
23
/**
22
24
* Hostname/IP-Address of the Logstash/Graylog Host
23
25
* By default it uses UDP, prepend tcp: to the hostname to switch to TCP, example: "tcp:localhost"
24
26
*/
25
- @ ConfigItem ( defaultValue = "localhost" )
26
- public String host ;
27
+ @ WithDefault ( "localhost" )
28
+ String host () ;
27
29
28
30
/**
29
31
* The port
30
32
*/
31
- @ ConfigItem ( defaultValue = "12201" )
32
- public int port ;
33
+ @ WithDefault ( "12201" )
34
+ int port () ;
33
35
34
36
/**
35
37
* GELF version: 1.0 or 1.1
36
38
*/
37
- @ ConfigItem ( defaultValue = "1.1" )
38
- public String version ;
39
+ @ WithDefault ( "1.1" )
40
+ String version () ;
39
41
40
42
/**
41
43
* Whether to post Stack-Trace to StackTrace field.
42
44
*
43
45
* @see #stackTraceThrowableReference to customize the way the Stack-Trace is handled.
44
46
*/
45
- @ ConfigItem ( defaultValue = "true" )
46
- public boolean extractStackTrace ;
47
+ @ WithDefault ( "true" )
48
+ boolean extractStackTrace () ;
47
49
48
50
/**
49
51
* Only used when `extractStackTrace` is `true`.
@@ -53,32 +55,32 @@ public class GelfConfig {
53
55
* Negative throwable reference walk the exception chain from the root cause side: -1 will extract the root cause,
54
56
* -2 the exception wrapping the root cause, ...
55
57
*/
56
- @ ConfigItem
57
- public int stackTraceThrowableReference ;
58
+ @ WithDefault ( "0" )
59
+ int stackTraceThrowableReference () ;
58
60
59
61
/**
60
62
* Whether to perform Stack-Trace filtering
61
63
*/
62
- @ ConfigItem
63
- public boolean filterStackTrace ;
64
+ @ WithDefault ( "false" )
65
+ boolean filterStackTrace () ;
64
66
65
67
/**
66
68
* Java date pattern, see {@link java.text.SimpleDateFormat}
67
69
*/
68
- @ ConfigItem ( defaultValue = "yyyy-MM-dd HH:mm:ss,SSS" )
69
- public String timestampPattern ;
70
+ @ WithDefault ( "yyyy-MM-dd HH:mm:ss,SSS" )
71
+ String timestampPattern () ;
70
72
71
73
/**
72
74
* The logging-gelf log level.
73
75
*/
74
- @ ConfigItem ( defaultValue = "ALL" )
75
- public Level level ;
76
+ @ WithDefault ( "ALL" )
77
+ Level level () ;
76
78
77
79
/**
78
80
* Name of the facility.
79
81
*/
80
- @ ConfigItem ( defaultValue = "jboss-logmanager" )
81
- public String facility ;
82
+ @ WithDefault ( "jboss-logmanager" )
83
+ String facility () ;
82
84
83
85
/**
84
86
* Post additional fields.
@@ -89,67 +91,62 @@ public class GelfConfig {
89
91
* quarkus.log.handler.gelf.additional-field.field1.type=String
90
92
* </pre>
91
93
*/
92
- @ ConfigItem
93
- @ ConfigDocMapKey ("field-name" )
94
94
@ ConfigDocSection
95
- public Map <String , AdditionalFieldConfig > additionalField ;
95
+ @ ConfigDocMapKey ("field-name" )
96
+ Map <String , AdditionalFieldConfig > additionalField ();
96
97
97
98
/**
98
99
* Whether to include all fields from the MDC.
99
100
*/
100
- @ ConfigItem
101
- public boolean includeFullMdc ;
101
+ @ WithDefault ( "false" )
102
+ boolean includeFullMdc () ;
102
103
103
104
/**
104
105
* Send additional fields whose values are obtained from MDC. Name of the Fields are comma-separated. Example:
105
106
* mdcFields=Application,Version,SomeOtherFieldName
106
107
*/
107
- @ ConfigItem ()
108
- public Optional <String > mdcFields ;
108
+ Optional <String > mdcFields ();
109
109
110
110
/**
111
111
* Dynamic MDC Fields allows you to extract MDC values based on one or more regular expressions. Multiple regexes are
112
112
* comma-separated. The name of the MDC entry is used as GELF field name.
113
113
*/
114
- @ ConfigItem
115
- public Optional <String > dynamicMdcFields ;
114
+ Optional <String > dynamicMdcFields ();
116
115
117
116
/**
118
117
* Pattern-based type specification for additional and MDC fields. Key-value pairs are comma-separated. Example:
119
118
* my_field.*=String,business\..*\.field=double
120
119
*/
121
- @ ConfigItem
122
- public Optional <String > dynamicMdcFieldTypes ;
120
+ Optional <String > dynamicMdcFieldTypes ();
123
121
124
122
/**
125
123
* Maximum message size (in bytes).
126
124
* If the message size is exceeded, the appender will submit the message in multiple chunks.
127
125
*/
128
- @ ConfigItem ( defaultValue = "8192" )
129
- public int maximumMessageSize ;
126
+ @ WithDefault ( "8192" )
127
+ int maximumMessageSize () ;
130
128
131
129
/**
132
130
* Include message parameters from the log event
133
131
*/
134
- @ ConfigItem ( defaultValue = "true" )
135
- public boolean includeLogMessageParameters ;
132
+ @ WithDefault ( "true" )
133
+ boolean includeLogMessageParameters () ;
136
134
137
135
/**
138
136
* Include source code location
139
137
*/
140
- @ ConfigItem ( defaultValue = "true" )
141
- public boolean includeLocation ;
138
+ @ WithDefault ( "true" )
139
+ boolean includeLocation () ;
142
140
143
141
/**
144
142
* Origin hostname
145
143
*/
146
- @ ConfigItem
147
- public Optional <String > originHost ;
144
+ Optional <String > originHost ();
148
145
149
146
/**
150
147
* Bypass hostname resolution. If you didn't set the {@code originHost} property, and resolution is disabled, the value
151
148
* “unknown” will be used as hostname
152
149
*/
153
- @ ConfigItem
154
- public boolean skipHostnameResolution ;
150
+ @ WithDefault ( "false" )
151
+ boolean skipHostnameResolution () ;
155
152
}
0 commit comments