Closed mikeycmccarthy closed 12 years ago
Hi,
By log4j file you mean log4j.properties and/or log4j.xml? The logic itself handled by the Log4J framework, it reads and sets properties.
Could you please give me an example of log4j file you're trying to use?
Hope this helps and thanks, Anton
Edit: Clarifications
Weird, could have sworn I commented. It was a log4j.properties, and it looks like this:
log4j.appender.graylog2=org.graylog2.log.GelfAppender log4j.appender.graylog2.graylogHost=man00.xxxx log4j.appender.graylog2.originHost=FQDN log4j.appender.graylog2.facility=xxxx log4j.appender.graylog2.layout=org.apache.log4j.PatternLayout log4j.appender.graylog2.layout.ConversionPattern=%d{ABSOLUTE} %5p %t %c{2}:%L - %m%n log4j.appender.graylog2.extractStacktrace=true log4j.appender.graylog2.addExtendedInformation=true log4j.appender.graylog2.additionalFields={'xxxx': 'DEV', 'application': 'xxx'} log4j.category.org.springframework.beans.factory=DEBUG
I've had to x out a few things but you get the idea. Michael
Just to be sure: The log4j.appender.graylog2.facility property is not being pushed to graylog2 server?
Cheers, Anton
Hi Anton,
It's always being pushed as gelf-java. Digging through the code I can see this is the default, which makes me feel that in the parsing of the log4j.properties file the facility is not being read properly and it's sending the default instead. I'm looking through GelfHandler at the moment to see if I can see anything. I'll try to build a version with some tracing in it and try with that if I can't narrow it down with a unit test.
Thanks Michael
On 7 March 2012 11:26, Anton < reply@reply.github.com
wrote:
Just to be sure: The log4j.appender.graylog2.facility property is not being pushed to graylog2 server?
Cheers, Anton
Reply to this email directly or view it on GitHub: https://github.com/t0xa/gelfj/issues/29#issuecomment-4366496
Thanks a lot for clarifications I will look into it as well.
Just used the trunk version against the newest graylog and the custom facility is coming out, so whatever I was seeing has been fixed on trunk. I'll run against an older version so I can confirm where the issue was resolved. Regards, Michael
It was added in 0.7 in the merge with the joschi branch - feel free to close this issue.
Hi Michael,
Sorry for my slow reaction time and for old versions in the Downloads sections. Will try to clean it up soon.
Anton
Hi there,
We're using the gelf appender and the facility is always set to to be gelf-java. I'm having a look through the source code at the moment and I can see that gelf-java is the default set on a GelfMessage. My guess is that it is not being read correctly from the log4j file and therefore not being set.
I'm trying to write a unit test that would prove this either way, but I can't see the code that converts a log4j file into a GelfAppender. If you can help me out I will try to write a failing test.
Thanks!