Logging to a file

This section describes how to print all the Payara Micro log messages into a file.

Logging to a file from the Command Line

To print all of the Payara Micro log messages into a file from the command line, you will need to use the --logToFile option, followed by either a path to where you want to put the log file or by giving the name of a file you want to print the logs into. If a file name is not given, a default file called payara-server.log is generated.

java -jar payara-micro.jar --logToFile /home/user/PayaraMicro.log

Logging to a file Programmatically

To print all the Payara Micro log messages into a file programmatically, you will need to use setUserLogFile(String filePath) method.

import fish.payara.micro.PayaraMicro;
import fish.payara.micro.BootstrapException;

public class EmbeddedPayara{
    public static void main(String[] args) throws BootstrapException{


You can specify a Logging Properties File to configure the JUL logger for Payara Micro.

Options Type Description Default Mandatory



File with logging configuration




Enable dynamic reloading of configuration




You can provide a logging configuration file that uses the standard JUL notation RDP Logging Config

java -jar payara-micro.jar --logProperties micro-logging.properties --enableDynamicLogging --deploy myapplication.war