Permalink
Browse files

Merge pull request #2 from rlewon/graylog_facility_fix

Fixes for appender for proper facility.
  • Loading branch information...
2 parents 44405ed + f971239 commit 086004fe69a9b599083e04f739dc78861c3486bd @ligature ligature committed Mar 27, 2012
Showing with 17 additions and 12 deletions.
  1. +1 −1 build.gradle
  2. +1 −1 pom.xml
  3. +15 −10 src/main/java/org/graylog2/log/GelfConsoleAppender.java
View
2 build.gradle
@@ -1,7 +1,7 @@
apply plugin: 'java'
sourceCompatibility = 1.5
-version = '0.9.2'
+version = '0.9.3'
jar {
manifest {
attributes 'Implementation-Title': 'GELF Java Implementation', 'Implementation-Version': version
View
2 pom.xml
@@ -6,7 +6,7 @@
<groupId>org.graylog2</groupId>
<artifactId>gelfj</artifactId>
- <version>0.9.2-SNAPSHOT</version>
+ <version>0.9.3-SNAPSHOT</version>
<packaging>jar</packaging>
<name>gelfj</name>
View
25 src/main/java/org/graylog2/log/GelfConsoleAppender.java
@@ -24,15 +24,16 @@
*
*/
public class GelfConsoleAppender extends ConsoleAppender implements GelfMessageProvider{
-
+
private static String originHost;
private boolean extractStacktrace;
private boolean addExtendedInformation;
private Map<String, String> fields;
+ private String facility;
private boolean facilityIsLogger;
// parent overrides.
-
+
public GelfConsoleAppender() {
super(); //To change body of overridden methods use File | Settings | File Templates.
}
@@ -44,29 +45,29 @@ public GelfConsoleAppender(Layout layout) {
public GelfConsoleAppender(Layout layout, String target) {
super(layout, target); //To change body of overridden methods use File | Settings | File Templates.
}
-
+
// GelfMessageProvider interface.
-
+
public void setAdditionalFields(String additionalFields) {
fields = (Map<String, String>) JSONValue.parse(additionalFields.replaceAll("'", "\""));
}
-
+
public boolean isExtractStacktrace() {
return extractStacktrace;
}
public void setExtractStacktrace(boolean extractStacktrace) {
this.extractStacktrace = extractStacktrace;
}
-
+
public boolean isAddExtendedInformation() {
return addExtendedInformation;
}
public void setAddExtendedInformation(boolean addExtendedInformation) {
this.addExtendedInformation = addExtendedInformation;
}
-
+
public String getOriginHost() {
return originHost;
}
@@ -76,13 +77,17 @@ public void setOriginHost(String originHost) {
}
public String getFacility() {
- return null;
+ return facility;
+ }
+
+ public void setFacility(String facility) {
+ this.facility = facility;
}
public void setFacilityIsLogger(boolean facilityIsLogger) {
this.facilityIsLogger = facilityIsLogger;
}
-
+
public boolean getFacilityIsLogger() {
return this.facilityIsLogger;
}
@@ -95,7 +100,7 @@ public boolean getFacilityIsLogger() {
}
// the important parts.
-
+
@Override
protected void subAppend(LoggingEvent event) {
GelfMessage gelf = GelfMessageFactory.makeMessage(event, this);

0 comments on commit 086004f

Please sign in to comment.