1919
2020public class Config {
2121
22- public static final String DEFAULT_ES_HOST = "localhost" ;
23- public static final int DEFAULT_ES_PORT = 9200 ;
22+ public static final String DEFAULT_HOST = "localhost" ;
23+ public static final int DEFAULT_PORT = 9200 ;
2424 public static final String DEFAULT_INDEX_NAME = "wls" ;
2525 public static final int DEFAULT_BULK_SIZE = 1 ;
2626 private static final String DEFAULT_DOMAIN_UID = "unknown" ;
2727
28- private static final String HOST = "ElasticSearchHost " ;
29- private static final String PORT = "ElasticSearchPort " ;
28+ private static final String HOST = "publishHost " ;
29+ private static final String PORT = "publishPort " ;
3030 private static final String FILTERS = "weblogicLoggingExporterFilters" ;
3131 private static final String ENABLED = "weblogicLoggingExporterEnabled" ;
3232 private static final String SEVERITY = "weblogicLoggingExporterSeverity" ;
3333 private static final String BULK_SIZE = "weblogicLoggingExporterBulkSize" ;
3434 private static final String INDEX_NAME = "weblogicLoggingIndexName" ;
3535 private static final String DOMAIN_UID = "domainUID" ;
3636
37- private String host = DEFAULT_ES_HOST ;
38- private int port = DEFAULT_ES_PORT ;
37+ private String host = DEFAULT_HOST ;
38+ private int port = DEFAULT_PORT ;
3939 private String indexName = DEFAULT_INDEX_NAME ;
4040 private int bulkSize = DEFAULT_BULK_SIZE ;
4141 private boolean enabled = true ;
@@ -46,18 +46,34 @@ public class Config {
4646 private Config () {}
4747
4848 private Config (Map <String , Object > yaml ) {
49- if (yaml .containsKey (HOST )) host = MapUtils .getStringValue (yaml , HOST );
50- if (yaml .containsKey (PORT )) port = MapUtils .getIntegerValue (yaml , PORT );
51- if (yaml .containsKey (ENABLED )) enabled = MapUtils .getBooleanValue (yaml , ENABLED );
52- if (yaml .containsKey (SEVERITY )) severity = MapUtils .getStringValue (yaml , SEVERITY );
53- if (yaml .containsKey (BULK_SIZE )) bulkSize = MapUtils .getIntegerValue (yaml , BULK_SIZE );
54- if (yaml .containsKey (INDEX_NAME )) indexName = MapUtils .getStringValue (yaml , INDEX_NAME );
55- if (yaml .containsKey (DOMAIN_UID )) domainUID = MapUtils .getStringValue (yaml , DOMAIN_UID );
49+ if (yaml .containsKey (HOST )) {
50+ host = MapUtils .getStringValue (yaml , HOST );
51+ }
52+ if (yaml .containsKey (PORT )) {
53+ port = MapUtils .getIntegerValue (yaml , PORT );
54+ }
55+ if (yaml .containsKey (ENABLED )) {
56+ enabled = MapUtils .getBooleanValue (yaml , ENABLED );
57+ }
58+ if (yaml .containsKey (SEVERITY )) {
59+ severity = MapUtils .getStringValue (yaml , SEVERITY );
60+ }
61+ if (yaml .containsKey (BULK_SIZE )) {
62+ bulkSize = MapUtils .getIntegerValue (yaml , BULK_SIZE );
63+ }
64+ if (yaml .containsKey (INDEX_NAME )) {
65+ indexName = MapUtils .getStringValue (yaml , INDEX_NAME );
66+ }
67+ if (yaml .containsKey (DOMAIN_UID )) {
68+ domainUID = MapUtils .getStringValue (yaml , DOMAIN_UID );
69+ }
5670 if (bulkSize <= 1 ) {
5771 bulkSize = 1 ;
5872 }
5973 // index name needs to be all lowercase.
60- if (yaml .containsKey (INDEX_NAME )) indexName = MapUtils .getStringValue (yaml , INDEX_NAME );
74+ if (yaml .containsKey (INDEX_NAME )) {
75+ indexName = MapUtils .getStringValue (yaml , INDEX_NAME );
76+ }
6177 if (!(indexName .toLowerCase ().equals (indexName ))) {
6278 indexName = indexName .toLowerCase ();
6379 System .out .println ("Index name is converted to all lower case : " + indexName );
@@ -136,10 +152,10 @@ public String toString() {
136152 + "weblogicLoggingIndexName='"
137153 + indexName
138154 + '\''
139- + ", ElasticSearchHost ='"
155+ + ", publishHost ='"
140156 + host
141157 + '\''
142- + ", ElasticSearchPort ="
158+ + ", publishPort ="
143159 + port
144160 + ", weblogicLoggingExporterSeverity='"
145161 + severity
0 commit comments