I am trying to create a logs file in a Java swings application that will contain all the messages generated by the code. But unfortunately it does not create 1 single log file but creates a structure as shown. I need 1 single log file. 

[![enter image description here](https://i.stack.imgur.com/rJkRp.png)](https://i.stack.imgur.com/rJkRp.png)

My code:

```
 //get the logger object
logger = Logger.getLogger("MyLog");

try {
    // This block configure the logger with handler and formatter
    loggerFH = new FileHandler(System.getProperty("user.dir") + "\\resources\\logs\\logs.txt",true);
    logger.addHandler(loggerFH);            

    SimpleFormatter formatter = new SimpleFormatter();
    loggerFH.setFormatter(formatter);

} catch (IOException | SecurityException ex) {
    logger.severe(ex.getMessage());
    outputArea.append(ex.getMessage());

} 

```