0

I 've done a cluster with Payara Server composed by two instances, one is local ad resides onto a debian VM and the other one ,remote, resides also onto another debian VM. I deployed a test application and when I was looking to logs just wasn't able to find them. More precisely, I ment just one time almost randomly seem they appear and then nothing more. They show up into Admin Server-->View Logs File --> instance 1(local) -->log file --> server.log.

Below test application

package clusterTest;

import java.io.Serializable;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

@ManagedBean
@SessionScoped
public class MySession implements Serializable {

    private String val;
    private static final Logger LOG = Logger.getLogger(MySession.class.getName());



    public String getVal() {
        LOG.log(Level.INFO, "getVal{0}", val);
        System.out.println("getVal");
        return val;
    }

    public void setVal(String val) {
        LOG.log(Level.INFO, "setVal{0}", val);
        System.out.println("setVal");
        this.val = val;        
    }

}

image of the log file

user2946593
  • 63
  • 2
  • 11

2 Answers2

1

Payara Server creates a separate directory for each instance, so that it does not mix with the working directory of the domain admin server.

In short, if your domain name is domain1, you should be able to find logs for your local instance in PAYARA_INSTALL/glassfish/nodes/localhost-domain1/instance1/logs/server.log.

Payara Server, as well as GlassFish, creates instances and places them under nodes. Nodes represent the location of the instances - in your case you most probably have a local node and a node for the second remote instance. Their configuration is part of the domain.xml, but before instances are first started, Payara Server generates another separate directory with config and runtime data like logs, in a directory inside the glassfish/nodes directory, which is in the same directory as domains directory.

The files for remote instance should exist inside the remote Payara Server installation in a similar location.

OndroMih
  • 7,280
  • 1
  • 26
  • 44
  • What you have just said is correct and in sight of this I can not explain why ,as you can figure out from the image attached above, test application write log just 2 times and not anymore. I keep testing but "LOG.log(Level.INFO, "getVal{0}", val);" doesn't work. – user2946593 Sep 29 '16 at 09:23
  • In your screenshot, only `getVal()` has been called, which means that the `val` variable has not been initialised, hence the first one logs out val as `null` at `SEVERE` level. You should really add a null check there, and properly initialise the variable. – Mike Sep 29 '16 at 12:26
  • Also, do be aware that this page in the admin console does **not** dynamically update; the page must be refreshed. To be really sure of what is going on, you should manually check the log file on the file system as Ondrej has pointed out. – Mike Sep 29 '16 at 12:27
  • I checked all folders as @OndrejM on the file system suggested and I didn't find any occurences except those showed before. Moreover logging works exactly as supposed to be if test appliacation is deployed into payara server. Insted, when deployed into a cluster (payara), test application' logs don't show up. – user2946593 Sep 29 '16 at 14:10
  • Have you tried debugging if the getVal method really gets executed more times? If yes, you may try to debug Payara in the same manner - the sources are available in [maven central](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22fish.payara.distributions%22%20AND%20a%3A%22payara%22). If you think it is a bug in Payara Server, you'd be better reporting an issue in [github](https://github.com/payara/Payara), providing details about your configuration and ideally a sample application. – OndroMih Sep 29 '16 at 22:23
  • After changed handler to java.util.logging.GFFileHandler ( into DAS) and of course some minor changes, test application logs correctly. Now I am able to to see log into--> instance1 -->server.log, but if I switch off local instance (cluster still serves requests and keep session data) and try to search for test application'logs into instace2(remoteNode) , nothing has shown. I expected hower to find logs into instance2(remote), it makes sense? – user2946593 Sep 30 '16 at 10:53
  • I came around this issue and can confirm that the output in the logs stops after embedded JMS broker is started. I managed to get the output when I changed the configuration of the JMS broker to from EMBEDDED to LOCAL (see my other answer here: http://stackoverflow.com/a/40038645/784594). I suggest raising an issue on github: https://github.com/payara/Payara/issues – OndroMih Oct 14 '16 at 08:39
0

As @nakag has already said here at https://stackoverflow.com/a/31783809/2946593, using the loopback address in /ect/hosts stop showing logs into cluster's instance. So just comment out this row :

127.0.1.1 "name_of_server"

in each node of the cluster solved the problem.

Community
  • 1
  • 1
user2946593
  • 63
  • 2
  • 11
  • I managed to see the logs in cluster instances when changed JMS broker from EMBEDDED to LOCAL, see here: https://github.com/payara/Payara/issues – OndroMih Oct 14 '16 at 08:39