Repository: ManimCommunity/manim

Issue:
Issue Saving Log files
https://github.com/ManimCommunity/manim/blob/e011f640cf085879b67cce7bc0dc08450ba92d3b/manim/config/config.py#L158-L165
Here it defines that scene name will be log file name.  But a problem is when I tried with no scene name and entered it at runtime. The log file a saved in `media/logs/.log` which is weird and should not happen.


Discussion:
Yes, and the why is indicated in the comment. 
I think this should be changed, and follow @leotrs suggestion that is to set log name as the name of the file containing the scene. 
Hi, I want to contribute, but not sure how to reproduce the issue: `manim scene.py SquareToCircle -pl` does not produce any logs
Try `manim scene.py SquareToCircle -pl --log_to_file`.

Resolving patch:
diff --git a/manim/config/config.py b/manim/config/config.py
--- a/manim/config/config.py
+++ b/manim/config/config.py
@@ -156,10 +156,19 @@ def _parse_config(config_parser, args):
 # Set the different loggers
 set_rich_logger(config_parser["logger"], file_writer_config["verbosity"])
 if file_writer_config["log_to_file"]:
-    # IMPORTANT note about file name : The log file name will be the scene_name get from the args (contained in file_writer_config). So it can differ from the real name of the scene.
+    # Note about log_file_name : The log file name will be the <name_of_animation_file>_<name_of_scene>.log
+    # get from the args (contained in file_writer_config). So it can differ from the real name of the scene.
+    # <name_of_scene> would only appear if scene name was provided on manim call
+    scene_name_suffix = "".join(file_writer_config["scene_names"])
+    scene_file_name = os.path.basename(args.file).split(".")[0]
+    log_file_name = (
+        f"{scene_file_name}_{scene_name_suffix}.log"
+        if scene_name_suffix
+        else f"{scene_file_name}.log"
+    )
     log_file_path = os.path.join(
         file_writer_config["log_dir"],
-        "".join(file_writer_config["scene_names"]) + ".log",
+        log_file_name,
     )
     set_file_logger(log_file_path)
-    logger.info("Log file wil be saved in %(logpath)s", {"logpath": log_file_path})
+    logger.info("Log file will be saved in %(logpath)s", {"logpath": log_file_path})


Test patch:
diff --git a/tests/control_data/logs_data/BasicSceneLoggingTest.txt b/tests/control_data/logs_data/BasicSceneLoggingTest.txt
--- a/tests/control_data/logs_data/BasicSceneLoggingTest.txt
+++ b/tests/control_data/logs_data/BasicSceneLoggingTest.txt
@@ -1,4 +1,4 @@
-{"levelname": "INFO", "module": "config", "message": "Log file wil be saved in <>"}
+{"levelname": "INFO", "module": "config", "message": "Log file will be saved in <>"}
 {"levelname": "DEBUG", "module": "hashing", "message": "Hashing ..."}
 {"levelname": "DEBUG", "module": "hashing", "message": "Hashing done in <> s."}
 {"levelname": "INFO", "module": "scene_file_writer", "message": "Animation 0 : Partial movie file written in <>"}
diff --git a/tests/test_logging/basic_scenes_square_to_circle.py b/tests/test_logging/basic_scenes_square_to_circle.py
new file mode 100644
--- /dev/null
+++ b/tests/test_logging/basic_scenes_square_to_circle.py
@@ -0,0 +1,8 @@
+from manim import *
+
+# This module is used in the CLI tests in tests_CLi.py.
+
+
+class SquareToCircle(Scene):
+    def construct(self):
+        self.play(Transform(Square(), Circle()))
diff --git a/tests/test_logging/basic_scenes.py b/tests/test_logging/basic_scenes_wirte_stuff.py
similarity index 82%
rename from tests/test_logging/basic_scenes.py
rename to tests/test_logging/basic_scenes_wirte_stuff.py
--- a/tests/test_logging/basic_scenes.py
+++ b/tests/test_logging/basic_scenes_wirte_stuff.py
@@ -3,11 +3,6 @@
 # This module is used in the CLI tests in tests_CLi.py.
 
 
-class SquareToCircle(Scene):
-    def construct(self):
-        self.play(Transform(Square(), Circle()))
-
-
 class WriteStuff(Scene):
     def construct(self):
         example_text = Tex("This is a some text", tex_to_color_map={"text": YELLOW})
diff --git a/tests/test_logging/test_logging.py b/tests/test_logging/test_logging.py
--- a/tests/test_logging/test_logging.py
+++ b/tests/test_logging/test_logging.py
@@ -9,10 +9,13 @@
 
 
 @logs_comparison(
-    "BasicSceneLoggingTest.txt", os.path.join("logs", "SquareToCircle.log")
+    "BasicSceneLoggingTest.txt",
+    os.path.join("logs", "basic_scenes_square_to_circle_SquareToCircle.log"),
 )
 def test_logging_to_file(tmp_path, python_version):
-    path_basic_scene = os.path.join("tests", "test_logging", "basic_scenes.py")
+    path_basic_scene = os.path.join(
+        "tests", "test_logging", "basic_scenes_square_to_circle.py"
+    )
     command = [
         python_version,
         "-m",
@@ -28,3 +31,27 @@ def test_logging_to_file(tmp_path, python_version):
     ]
     _, err, exitcode = capture(command)
     assert exitcode == 0, err
+
+
+@logs_comparison(
+    "BasicSceneLoggingTest.txt",
+    os.path.join("logs", "basic_scenes_square_to_circle.log"),
+)
+def test_logging_when_scene_is_not_specified(tmp_path, python_version):
+    path_basic_scene = os.path.join(
+        "tests", "test_logging", "basic_scenes_square_to_circle.py"
+    )
+    command = [
+        python_version,
+        "-m",
+        "manim",
+        path_basic_scene,
+        "-l",
+        "--log_to_file",
+        "-v",
+        "DEBUG",
+        "--media_dir",
+        str(tmp_path),
+    ]
+    _, err, exitcode = capture(command)
+    assert exitcode == 0, err