diff --git a/core/io/logger.cpp b/core/io/logger.cpp index ef78b1194ee..886e5695b1a 100644 --- a/core/io/logger.cpp +++ b/core/io/logger.cpp @@ -152,7 +152,7 @@ void RotatedFileLogger::rotate_file() { char timestamp[21]; OS::Date date = OS::get_singleton()->get_date(); OS::Time time = OS::get_singleton()->get_time(); - sprintf(timestamp, "-%04d-%02d-%02d-%02d-%02d-%02d", date.year, date.month, date.day, time.hour, time.min, time.sec); + sprintf(timestamp, "_%04d-%02d-%02d_%02d-%02d-%02d", date.year, date.month, date.day, time.hour, time.min, time.sec); String backup_name = base_path.get_basename() + timestamp; if (base_path.get_extension() != String()) { diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 6a7a6b84f60..c8427ac61f9 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -802,10 +802,12 @@ If [code]true[/code], logs all output to files. - + + + Path to logs within the project. Using an [code]user://[/code] path is recommended. - + Specifies the maximum amount of log files allowed (used for rotation). diff --git a/main/main.cpp b/main/main.cpp index 608b4a7c4d8..f78990c590f 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -954,8 +954,13 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph #endif GLOBAL_DEF("logging/file_logging/enable_file_logging", false); - GLOBAL_DEF("logging/file_logging/log_path", "user://logs/log.txt"); - GLOBAL_DEF("logging/file_logging/max_log_files", 10); + // Only file logging by default on desktop platforms as logs can't be + // accessed easily on mobile/Web platforms (if at all). + // This also prevents logs from being created for the editor instance, as feature tags + // are disabled while in the editor (even if they should logically apply). + GLOBAL_DEF("logging/file_logging/enable_file_logging.pc", true); + GLOBAL_DEF("logging/file_logging/log_path", "user://logs/godot.log"); + GLOBAL_DEF("logging/file_logging/max_log_files", 5); ProjectSettings::get_singleton()->set_custom_property_info("logging/file_logging/max_log_files", PropertyInfo(Variant::INT, "logging/file_logging/max_log_files", PROPERTY_HINT_RANGE, "0,20,1,or_greater")); //no negative numbers if (FileAccess::get_create_func(FileAccess::ACCESS_USERDATA) && GLOBAL_GET("logging/file_logging/enable_file_logging")) { String base_path = GLOBAL_GET("logging/file_logging/log_path");