@@ -25,6 +25,7 @@ public class RelpConfig {
2525 private String address ; // Relp server address
2626 private String appname ; // appname for syslog message
2727 private String hostname ; // hostname for syslog message
28+ private String realHostName ; // hostname for syslog origin header
2829 private String name ; // logger name
2930 private Boolean useSD ; // if structured data should be used
3031 private int connectionTimeout ; // Relp connection timeout
@@ -39,6 +40,7 @@ public RelpConfig(String name) throws NumberFormatException, IllegalArgumentExce
3940 initPort ();
4041 initAddress ();
4142 initAppname ();
43+ initRealHostName ();
4244 initHostName ();
4345 initReconnectInterval ();
4446 initUseSD ();
@@ -105,14 +107,24 @@ public String getAppname() {
105107 return this .appname ;
106108 }
107109
108- private void initHostName () {
110+
111+
112+ private void initRealHostName () {
109113 try {
110- this .hostname = InetAddress .getLocalHost ().getHostName ();
114+ this .realHostName = InetAddress .getLocalHost ().getHostName ();
111115 } catch (UnknownHostException e ) {
112- this .hostname = "localhost" ;
116+ this .realHostName = "localhost" ;
113117 }
114118 }
115119
120+ public String getRealHostName () {
121+ return this .realHostName ;
122+ }
123+
124+ private void initHostName () {
125+ this .hostname = getProperty ("hostname" , "localhost" );
126+ }
127+
116128 public String getHostname () {
117129 return this .hostname ;
118130 }
0 commit comments