Open skazal opened 10 years ago
Hi,
I should keep mah wiki pages up to date. I recommend using Maven or Gradle to automatically manage your dependencies.
Add the following dependency section to your pom.xml:
<dependencies>
...
<dependency>
<groupId>org.graylog2</groupId>
<artifactId>gelfj</artifactId>
<version>1.1.7</version>
<scope>compile</scope>
</dependency>
...
</dependencies>
If you really need to download JAR you can do that via Maven Central.
If you need more help, let me know.
Thanks
Thanks, your instructions are appreciated, unfortunately I've never used maven or gradle and I have no idea what a pom.xml is. I'm trying to use customize a vendor's product to use GELFJ to leverage the way they currently use log4j to write local log files and get their software to also send the log data to a Graylog2 server. I'm smart on some things but fairly clueless with what I need to do here.
Fair enough.
Managing dependencies manually is like chasing your own tail. It may not be applicable for your legacy project but it's definitely worth investing your time into learning about Maven and/or Gradle.
Thanks, you have made me smarter. How do you identify the version of log4j? I will take your advice and learn more about Maven and Gradle. The project that I'm working on and if it works, will be very significant to the vendor and (more importantly) the administrators of the tools. One question I have is the vendor has a bunch of log4j '.properties' files for various components of their system. Will I have to modify each appender definition in each file to use gelfj or is there a way to globally define it in one place so all existing loggers and any new ones will automatically send their messages to Graylog2?
How do you identify the version of log4j?
You can look at the filename or you can just try and plug appender in and see if it works.
Will I have to modify each appender definition in each file to use gelfj or is there a way to globally define it in one place so all existing loggers and any new ones will automatically send their messages to Graylog2?
It depends on the content of the properties files. Maybe it was intentional to have many and they serve different purpose. I recommend reviewing these files first and adjusting one by one.
Thanks. One last question for today. In the application logs, shortly after starting the application I'm seeing the message : log4j:ERROR Could not send GELF message. Where should I look for more details. This is running on Win2008R2 server. The Graylog2 server is RHEL 6.2 The application is using log4j -1.2.14
Hi, sorry I somehow missed your questions. Is this still actual?
I don't know how to send the message to the graylog2 after configuration the log4j, Is there a example java code? THX.
Hi, You just need to use standard log4j functionality and log something.
Logger barlogger = Logger.getLogger("com.foo.Bar");
barlogger.info("Located nearest gas station.");
Please look at Log4J tutorials.
In the documentation for "How to use GELFJ" it says:
"Grab latest JAR from the downloads section and drop it into your classpath. You will also need com.googlecode.json-simple, json-simple and log4j."
Forgive my ignorance, but what is the difference between "com.googlecode.json-simple" and "json-simple"? When I search for "com.googlecode.json-simple" they look like they're the same thing. If they're different, where do I find them?
Thanks!