users@grizzly.java.net

Re: Logging question

From: Ryan Lubke <ryan.lubke_at_oracle.com>
Date: Wed, 14 Dec 2011 16:57:07 -0800

On 12/14/11 2:17 PM, Kevin wrote:
> Hi All-
>
> How do I log incoming request to the Grizzly container? I've searched
> hi and low for this. Any direction would be appreciated.
We don't have much in the way of logging in this area at the moment.

Are you trying to debug an issue and need to see the http traffic? If
so, I'd recommend ngrep or wireshark. Or are you looking for something
more traditional like an access log?

Thanks,
-rl
>
> Thanks,
> Kevin
>
> My code
>
> public class GrizzlyJersey {
>
> /**
> * @param args the command line arguments
> */
> private static URI getBaseURI() {
> return UriBuilder.fromUri("http://localhost/").port(8080).build();
> }
>
> private final static Logger LOGGER =
> Logger.getLogger(GrizzlyJersey.class .getName());
>
> public static final URI BASE_URI = getBaseURI();
>
> protected static HttpServer startServer() throws IOException {
> final Map<String, String> initParams = new HashMap<String,
> String>();
>
> initParams.put("com.sun.jersey.config.property.packages",
> "com.frk.grizzlyjersey");
>
> System.out.println("Starting grizzly...");
> return GrizzlyWebContainerFactory.create(BASE_URI, initParams);
> }
>
> public static void main(String[] args) throws IOException {
>
>
>
> HttpServer httpServer = startServer();
>
> LOGGER.setLevel(Level.ALL);
>
> System.out.println(String.format("Jersey app started with WADL
> available at "
> + "%sapplication.wadl\nTry out %shelloworld\nHit enter
> to stop it...",
> BASE_URI, BASE_URI));
> System.in.read();
> httpServer.stop();
> }
> }
>