By the way, I found a solution to my problem with the logging configuration file that I reported here. The problem was to find an evidence that the logging configuration file could be referenced without changing the command line to add the parameter:

Why not change the command line? Basically, because I want to avoid command lines and continue clicking twice on the .jar file to open the application or enable a personalized logging if the application is distributed by Java Webstart.

If the logging configuration file doesn’t exist, I want to generate this file according to the initial needs of the application. A basic need is to store logging files in a separate folder called log, placed in the same folder where the application is executed (working directory). The content of this file should be in xml to be processed afterwards by a logging analyzer. So, I implemented the following code in the main class (class where I implement the main method to initialize the application):

// this method is invoked in the main method
// to initialize the logging.
public static void prepareLogging() {
  File loggingConfigurationFile = new File("");
  logger = Logger.getLogger(Main.class.getName());

  // it only generates the configuration file
  // if it really doesn't exist.
  if(!loggingConfigurationFile.exists()) {
    Writer output = null;
    try {        
      output = new BufferedWriter(
                    new FileWriter(loggingConfigurationFile));
      // The configuration file is a property file.
      // The Properties class gives support to
      // define and persist the logging configuration.
      Properties logConf = new Properties();
      logConf.setProperty(".level", "INFO");
           "java.util.logging.FileHandler.count", "1");
           "java.util.logging.XMLFormatter");, "Generated");
    catch (IOException ex) {
                 "Logging configuration file not created", ex);
    finally {
      try {
      catch (IOException ex) {
              "Problems to save " +
              "the logging configuration file in the disc",

  // This is the way to define the system
  // property without changing the command line.  
  // It has the same effect of the parameter
  // -Djava.util.logging.config.file
  Properties prop = System.getProperties();

  // It creates the log directory if it doesn't exist  
  // In the configuration file above we specify this
  // folder to store log files:
  // logConf.setProperty(
  //         "java.util.logging.FileHandler.pattern",  
  //         "log/application.log");
  File logDir = new File("log");
  if(!logDir.exists()) {"Creating the logging directory");
  // It overwrites the current logging configuration
  // to the one in the configuration file.
  try {
  catch (IOException ex) {
      "Problems to load the logging "+
      "configuration file", ex);

This way, you can enable and better organize the logging of your application without any additional configuration. If you want to execute the application by command line it is still simple:

java -jar myapp.jar

Or simply click twice on the file in most of the cases. The point about this post is not only teach you about logging stuff, but also motivate you to keep things simple to the final user.