Results 1 to 7 of 7

Thread: How to use the Error Log??

  1. #1

    Default How to use the Error Log??

    Hello.

    Something that seems of supreme importance for modding MTWII and is one of the most basic (yet non-obvious and quite complicated) tools, and somehow I couldn't find a single tutorial on the net to help me do it. Is it possible that I am the only one who needs such tutorial? It can be extremely brief. One paragraph is probably enough.

    I'm struggling with a mod because of a mysterious CTD with no error message. I was hoping the error log could point me where the problem is, but turns out I can't put the log to work. How do you do it? I'm using a mod so I need the log to contain the errors from the mod, not the base game. I just need to be able to see the error messages like I could in Rome I. Thanks to all in advance.
    Last edited by es157; April 21, 2021 at 11:18 AM.

  2. #2
    Vladyvid's Avatar Wizard of Turmish
    Join Date
    Aug 2011
    Location
    Athkatla
    Posts
    2,132

    Default Re: How to use the Error Log??

    I cant remember exactly and im at work so i cant check with my files, but there is a one line of code that should look something like this:

    tracelog = true

    I think its in the .bat file.

  3. #3

    Default Re: How to use the Error Log??

    Add the following code to the mod's .cfg file.

    Code:
    [log]
    to = logs/system.log.txt
    ;level = * trace
    ;level = * error
    ;level = ai.ltgd trace
    level = *script* trace
    The commented-out lines are other types of logs that you can generate. I find the script trace to be the most useful. You should also make sure the mod is actually using the .cfg file (it may be referenced in the mod's .bat launcher). If the mod does not have a .cfg or .bat file, you can make these following the examples of vanilla and other mods.

  4. #4

    Default Re: How to use the Error Log??

    Quote Originally Posted by Callistonian View Post
    Add the following code to the mod's .cfg file.

    Code:
    [log]
    to = logs/system.log.txt
    ;level = * trace
    ;level = * error
    ;level = ai.ltgd trace
    level = *script* trace
    The commented-out lines are other types of logs that you can generate. I find the script trace to be the most useful. You should also make sure the mod is actually using the .cfg file (it may be referenced in the mod's .bat launcher). If the mod does not have a .cfg or .bat file, you can make these following the examples of vanilla and other mods.
    Hm, Ok, seems to work even when I put this code in the .cfg from the main MTW2 folder. Is that normal? The problem is, every time I play the game and get an error log file, my .cfg file seems to auto-edit back to the original form, i.e. removing the code that I just added. So every time I want to get error messages, I need to modify my .cfg even though it should just stay the way I left it. Why is this happening?

    Thanks in advance.

  5. #5

    Default Re: How to use the Error Log??

    If you're editing vanilla's medieval2.preference.cfg, make sure the file is not read-only. I recommend that you set up a .cfg file for your mod instead of editing the vanilla config file as you will have fewer issues and of course any other users of your mod (if you publish) will not want to replace their vanilla config file. A mod's .cfg file does not need anything in it, if you only include the [log] section above, it will pull all the other configs from medieval2.preference.cfg. Your entire .cfg file could be this:

    Code:
    [features]
    mod = mods/your_mod_folder_name
    
    [log]
    to = mods/your_mod_folder_name/logs/log_file_name.system.log.txt 
    level = *script* trace
    Also a note: if you do publish your mod, you may want to use the * error log instead of script trace as it's somewhat better for performance.

  6. #6

    Default Re: How to use the Error Log??

    Quote Originally Posted by Callistonian View Post
    If you're editing vanilla's medieval2.preference.cfg, make sure the file is not read-only. I recommend that you set up a .cfg file for your mod instead of editing the vanilla config file as you will have fewer issues and of course any other users of your mod (if you publish) will not want to replace their vanilla config file. A mod's .cfg file does not need anything in it, if you only include the [log] section above, it will pull all the other configs from medieval2.preference.cfg. Your entire .cfg file could be this:

    Code:
    [features]
    mod = mods/your_mod_folder_name
    
    [log]
    to = mods/your_mod_folder_name/logs/log_file_name.system.log.txt 
    level = *script* trace
    Also a note: if you do publish your mod, you may want to use the * error log instead of script trace as it's somewhat better for performance.
    Perfect! Thanks for the instructions.

  7. #7

    Default Re: How to use the Error Log??

    You can also find more info here on enhanced logging, and here to put more info like which faction turn it is.
    Here is also a detailled config file, in which you can find a way to have multiple log files, like this:
    Code:
    [log]
        to =mods/SS6.3/system.log.txt
        level = * error                                # basic logging
    #    level = * trace                                # detailled logging
    #    level = data* trace                            # on general error logging level, looks like we can precise trace for some sublevels only, like this line. Seems recursive.
    #    file = ai* mods/SS6.3/log/ai.log            # never fired?
        file = data* mods/SS6.3/log/data.log
        file = game* mods/SS6.3/log/game.log
        file = system* mods/SS6.3/log/system.log
    It will make more specific logs with only a partial outputs, but the main log system.log.txt will always have everything in it.
    Belovèse's Toolbox: export text files to spreadsheet, detailed unit stats
    Stainless Steel Historical Improvement Project (SSHIP) team member.
    Mini-mods: diplomacy and relation/reputation - detailled unit stats

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •