I have an application running on google appengine. I am trying to log to greylog2 from appengin(I do not want to use the app engine cloud logging but greylog)
here is the dependency on my pom:
<dependency>
<groupId>org.graylog2</groupId>
<artifactId>gelfj</artifactId>
<version>1.1.15</version>
</dependency>
and here is my code:
GelfMessage message = new GelfMessage("myMessage", "myMessage", new Date().getTime(), "1");
message.setHost("appspot");
message.setVersion("1.3");
message.setFacility("F");
GelfUDPSender gelfUDPSender;
gelfUDPSender = new GelfUDPSender("my-ip-address", 12202);
GelfSenderResult result = gelfUDPSender.sendMessage(message);
when I run this locally it works. But when I run this on appengine I see the following message:
Error for /worker
java.lang.NoClassDefFoundError: java.nio.channels.DatagramChannel is a restricted class.
Please see the Google App Engine developer's guide for more details.
at com.google.apphosting.runtime.security.shared.stub.java.nio.channels.DatagramChannel.<clinit>(DatagramChannel.java)
at org.graylog2.GelfUDPSender.initiateChannel(GelfUDPSender.java:31)
at org.graylog2.GelfUDPSender.<init>(GelfUDPSender.java:27)
EDIT: graylog works with firewall. I need to open a route for the appengine instance IP. does it have an IP?
is there any way to get the ip?
1) could not use the org.graylog2
jar since it isn't in the The JRE Class White List sould be using java.net.URLConnection
instead. see the docs
2) accourding to the docs :
App Engine does not currently provide a way to map static IP addresses to an application