2

I am using Glassfish 3.1.2.2. I have deployed Glassfish to localhost. I have enabled the monitoring service and set the log level to HIGH for all components.

enter image description here

I should be able to use the view the server logs at a REST end point at http://host:port/management/domain/view-log according to the official documentation, but I get a generic response:

$ curl -H "Accept: application/json" http://localhost:4848/monitoring/domain/view-log
{"message":"","command":"Monitoring Data","exit_code":"SUCCESS"}

I get a proper response at this address, so I think my configuration is mostly correct:

$ curl -H "Accept: application/json" http://localhost:4848/monitoring/domain/
{
   "message":"",
   "command":"Monitoring Data",
   "exit_code":"SUCCESS",
   "extraProperties":{
      "entity":{

      },
      "childResources":{
         "server":"http:\/\/localhost:4848\/monitoring\/domain\/server"
      }
   }
}

Note that the generic response I received is sent for any invalid endpoint under domain:

$ curl -H "Accept: application/json" http://localhost:4848/monitoring/domain/jklnjkn
{"message":"","command":"Monitoring Data","exit_code":"SUCCESS"}

How can I access the Glassfish 3.1.2.2 server logs using the monitoring REST end point?

DavidS
  • 163
  • 1
  • 1
  • 7

1 Answers1

1

I just spotted a typo in the documentation that lead me astray. The log files are available on the management path, not the monitoring path:

enter image description here

The log files are available on the management path, not the monitoring path. These are the correct resources:

Also, for some reason the view-log resource does not respond when you request JSON. The following request returns the log file:

$ curl http://localhost:4848/monitoring/domain/view-log

But this returns nothing:

$ curl -H "Accept: application/json" http://localhost:4848/management/domain/view-log

Does not.

view-log/details will respond with JSON if requested.

DavidS
  • 163
  • 1
  • 1
  • 7
  • While I think this is a good answer, I would welcome more insight and explanation if anyone has something to offer. – DavidS Jul 24 '15 at 18:29
  • FYI, I emailed the Glassfish documentation email address regarding this. – DavidS Jul 24 '15 at 18:46