We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
 Docker image making logfiles in user_data
docker image places error logfiles in user_data by default. (apparently it should not be doing that)
Maybe cud have it put them in a log dir?


docker-compose.yml

command: >
      trade
      --logfile /freqtrade/user_data/freqtrade.log

can maybe be changed to 
      --logfile /freqtrade/user_data/log/freqtrade.log


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `freqtrade/configuration/directory_operations.py`
Content:
```
1 import logging
2 import shutil
3 from pathlib import Path
4 from typing import Any, Dict, Optional
5 
6 from freqtrade.exceptions import OperationalException
7 from freqtrade.constants import USER_DATA_FILES
8 
9 logger = logging.getLogger(__name__)
10 
11 
12 def create_datadir(config: Dict[str, Any], datadir: Optional[str] = None) -> Path:
13 
14     folder = Path(datadir) if datadir else Path(f"{config['user_data_dir']}/data")
15     if not datadir:
16         # set datadir
17         exchange_name = config.get('exchange', {}).get('name').lower()
18         folder = folder.joinpath(exchange_name)
19 
20     if not folder.is_dir():
21         folder.mkdir(parents=True)
22         logger.info(f'Created data directory: {datadir}')
23     return folder
24 
25 
26 def create_userdata_dir(directory: str, create_dir: bool = False) -> Path:
27     """
28     Create userdata directory structure.
29     if create_dir is True, then the parent-directory will be created if it does not exist.
30     Sub-directories will always be created if the parent directory exists.
31     Raises OperationalException if given a non-existing directory.
32     :param directory: Directory to check
33     :param create_dir: Create directory if it does not exist.
34     :return: Path object containing the directory
35     """
36     sub_dirs = ["backtest_results", "data", "hyperopts", "hyperopt_results", "notebooks",
37                 "plot", "strategies", ]
38     folder = Path(directory)
39     if not folder.is_dir():
40         if create_dir:
41             folder.mkdir(parents=True)
42             logger.info(f'Created user-data directory: {folder}')
43         else:
44             raise OperationalException(
45                 f"Directory `{folder}` does not exist. "
46                 "Please use `freqtrade create-userdir` to create a user directory")
47 
48     # Create required subdirectories
49     for f in sub_dirs:
50         subfolder = folder / f
51         if not subfolder.is_dir():
52             subfolder.mkdir(parents=False)
53     return folder
54 
55 
56 def copy_sample_files(directory: Path, overwrite: bool = False) -> None:
57     """
58     Copy files from templates to User data directory.
59     :param directory: Directory to copy data to
60     :param overwrite: Overwrite existing sample files
61     """
62     if not directory.is_dir():
63         raise OperationalException(f"Directory `{directory}` does not exist.")
64     sourcedir = Path(__file__).parents[1] / "templates"
65     for source, target in USER_DATA_FILES.items():
66         targetdir = directory / target
67         if not targetdir.is_dir():
68             raise OperationalException(f"Directory `{targetdir}` does not exist.")
69         targetfile = targetdir / source
70         if targetfile.exists():
71             if not overwrite:
72                 logger.warning(f"File `{targetfile}` exists already, not deploying sample file.")
73                 continue
74             else:
75                 logger.warning(f"File `{targetfile}` exists already, overwriting.")
76         shutil.copy(str(sourcedir / source), str(targetfile))
77
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/freqtrade/configuration/directory_operations.py b/freqtrade/configuration/directory_operations.py
--- a/freqtrade/configuration/directory_operations.py
+++ b/freqtrade/configuration/directory_operations.py
@@ -33,8 +33,8 @@
     :param create_dir: Create directory if it does not exist.
     :return: Path object containing the directory
     """
-    sub_dirs = ["backtest_results", "data", "hyperopts", "hyperopt_results", "notebooks",
-                "plot", "strategies", ]
+    sub_dirs = ["backtest_results", "data", "hyperopts", "hyperopt_results", "logs",
+                "notebooks", "plot", "strategies", ]
     folder = Path(directory)
     if not folder.is_dir():
         if create_dir:

{"golden_diff": "diff --git a/freqtrade/configuration/directory_operations.py b/freqtrade/configuration/directory_operations.py\n--- a/freqtrade/configuration/directory_operations.py\n+++ b/freqtrade/configuration/directory_operations.py\n@@ -33,8 +33,8 @@\n     :param create_dir: Create directory if it does not exist.\n     :return: Path object containing the directory\n     \"\"\"\n-    sub_dirs = [\"backtest_results\", \"data\", \"hyperopts\", \"hyperopt_results\", \"notebooks\",\n-                \"plot\", \"strategies\", ]\n+    sub_dirs = [\"backtest_results\", \"data\", \"hyperopts\", \"hyperopt_results\", \"logs\",\n+                \"notebooks\", \"plot\", \"strategies\", ]\n     folder = Path(directory)\n     if not folder.is_dir():\n         if create_dir:\n", "issue": " Docker image making logfiles in user_data\ndocker image places error logfiles in user_data by default. (apparently it should not be doing that)\r\nMaybe cud have it put them in a log dir?\r\n\r\n\r\ndocker-compose.yml\r\n\r\ncommand: >\r\n      trade\r\n      --logfile /freqtrade/user_data/freqtrade.log\r\n\r\ncan maybe be changed to \r\n      --logfile /freqtrade/user_data/log/freqtrade.log\r\n\n", "before_files": [{"content": "import logging\nimport shutil\nfrom pathlib import Path\nfrom typing import Any, Dict, Optional\n\nfrom freqtrade.exceptions import OperationalException\nfrom freqtrade.constants import USER_DATA_FILES\n\nlogger = logging.getLogger(__name__)\n\n\ndef create_datadir(config: Dict[str, Any], datadir: Optional[str] = None) -> Path:\n\n    folder = Path(datadir) if datadir else Path(f\"{config['user_data_dir']}/data\")\n    if not datadir:\n        # set datadir\n        exchange_name = config.get('exchange', {}).get('name').lower()\n        folder = folder.joinpath(exchange_name)\n\n    if not folder.is_dir():\n        folder.mkdir(parents=True)\n        logger.info(f'Created data directory: {datadir}')\n    return folder\n\n\ndef create_userdata_dir(directory: str, create_dir: bool = False) -> Path:\n    \"\"\"\n    Create userdata directory structure.\n    if create_dir is True, then the parent-directory will be created if it does not exist.\n    Sub-directories will always be created if the parent directory exists.\n    Raises OperationalException if given a non-existing directory.\n    :param directory: Directory to check\n    :param create_dir: Create directory if it does not exist.\n    :return: Path object containing the directory\n    \"\"\"\n    sub_dirs = [\"backtest_results\", \"data\", \"hyperopts\", \"hyperopt_results\", \"notebooks\",\n                \"plot\", \"strategies\", ]\n    folder = Path(directory)\n    if not folder.is_dir():\n        if create_dir:\n            folder.mkdir(parents=True)\n            logger.info(f'Created user-data directory: {folder}')\n        else:\n            raise OperationalException(\n                f\"Directory `{folder}` does not exist. \"\n                \"Please use `freqtrade create-userdir` to create a user directory\")\n\n    # Create required subdirectories\n    for f in sub_dirs:\n        subfolder = folder / f\n        if not subfolder.is_dir():\n            subfolder.mkdir(parents=False)\n    return folder\n\n\ndef copy_sample_files(directory: Path, overwrite: bool = False) -> None:\n    \"\"\"\n    Copy files from templates to User data directory.\n    :param directory: Directory to copy data to\n    :param overwrite: Overwrite existing sample files\n    \"\"\"\n    if not directory.is_dir():\n        raise OperationalException(f\"Directory `{directory}` does not exist.\")\n    sourcedir = Path(__file__).parents[1] / \"templates\"\n    for source, target in USER_DATA_FILES.items():\n        targetdir = directory / target\n        if not targetdir.is_dir():\n            raise OperationalException(f\"Directory `{targetdir}` does not exist.\")\n        targetfile = targetdir / source\n        if targetfile.exists():\n            if not overwrite:\n                logger.warning(f\"File `{targetfile}` exists already, not deploying sample file.\")\n                continue\n            else:\n                logger.warning(f\"File `{targetfile}` exists already, overwriting.\")\n        shutil.copy(str(sourcedir / source), str(targetfile))\n", "path": "freqtrade/configuration/directory_operations.py"}], "after_files": [{"content": "import logging\nimport shutil\nfrom pathlib import Path\nfrom typing import Any, Dict, Optional\n\nfrom freqtrade.exceptions import OperationalException\nfrom freqtrade.constants import USER_DATA_FILES\n\nlogger = logging.getLogger(__name__)\n\n\ndef create_datadir(config: Dict[str, Any], datadir: Optional[str] = None) -> Path:\n\n    folder = Path(datadir) if datadir else Path(f\"{config['user_data_dir']}/data\")\n    if not datadir:\n        # set datadir\n        exchange_name = config.get('exchange', {}).get('name').lower()\n        folder = folder.joinpath(exchange_name)\n\n    if not folder.is_dir():\n        folder.mkdir(parents=True)\n        logger.info(f'Created data directory: {datadir}')\n    return folder\n\n\ndef create_userdata_dir(directory: str, create_dir: bool = False) -> Path:\n    \"\"\"\n    Create userdata directory structure.\n    if create_dir is True, then the parent-directory will be created if it does not exist.\n    Sub-directories will always be created if the parent directory exists.\n    Raises OperationalException if given a non-existing directory.\n    :param directory: Directory to check\n    :param create_dir: Create directory if it does not exist.\n    :return: Path object containing the directory\n    \"\"\"\n    sub_dirs = [\"backtest_results\", \"data\", \"hyperopts\", \"hyperopt_results\", \"logs\",\n                \"notebooks\", \"plot\", \"strategies\", ]\n    folder = Path(directory)\n    if not folder.is_dir():\n        if create_dir:\n            folder.mkdir(parents=True)\n            logger.info(f'Created user-data directory: {folder}')\n        else:\n            raise OperationalException(\n                f\"Directory `{folder}` does not exist. \"\n                \"Please use `freqtrade create-userdir` to create a user directory\")\n\n    # Create required subdirectories\n    for f in sub_dirs:\n        subfolder = folder / f\n        if not subfolder.is_dir():\n            subfolder.mkdir(parents=False)\n    return folder\n\n\ndef copy_sample_files(directory: Path, overwrite: bool = False) -> None:\n    \"\"\"\n    Copy files from templates to User data directory.\n    :param directory: Directory to copy data to\n    :param overwrite: Overwrite existing sample files\n    \"\"\"\n    if not directory.is_dir():\n        raise OperationalException(f\"Directory `{directory}` does not exist.\")\n    sourcedir = Path(__file__).parents[1] / \"templates\"\n    for source, target in USER_DATA_FILES.items():\n        targetdir = directory / target\n        if not targetdir.is_dir():\n            raise OperationalException(f\"Directory `{targetdir}` does not exist.\")\n        targetfile = targetdir / source\n        if targetfile.exists():\n            if not overwrite:\n                logger.warning(f\"File `{targetfile}` exists already, not deploying sample file.\")\n                continue\n            else:\n                logger.warning(f\"File `{targetfile}` exists already, overwriting.\")\n        shutil.copy(str(sourcedir / source), str(targetfile))\n", "path": "freqtrade/configuration/directory_operations.py"}]}