How to enable logging

whoward69

DLL Minion
Joined
May 30, 2011
Messages
8,691
Location
Near Portsmouth, UK
To enable logging, perform the following steps

  1. Locate the config.ini file (usually in the "C:\Users\{username}\Documents\My Games\Sid Meier's Civilization 5" sub-directory)
  2. Using a plain text editor (such as Notepad) open it
  3. Search for the text "ValidateGameDatabase" (it's near the top)
  4. Change it to
    Code:
    ; Validates the game database whenever it is changed.
    ValidateGameDatabase = 1
  5. Search for the text "LoggingEnabled" (it's just over half way down)
  6. Change it to
    Code:
    ; Enable the logging system
    LoggingEnabled = 1
  7. Save the changes

The log files will now (usually) be written to "C:\Users\{username}\Documents\My Games\Sid Meier's Civilization 5\Logs"
The files of specific interest are
  • database.log - contains errors from XML or SQL updates to the GameData database. Nearly all common "noob" errors are in here, so ALWAYS check this first.
  • xml.log - contains xml parsing and reference errors
  • lua.log - contains programming (lua) errors and messages (from print() statements)

The logs contain several errors generated by the core game. These can be ignored but you need to know what they are for your particular setup.

  1. Start Civ
  2. Enable all the mods you need, EXCEPT for the one you will be debugging
  3. Start a game
  4. Play the first turn
  5. Exit Civ
  6. Now look in the log files - any messages cannot be from your mod so you can ignore them
  7. Start Civ again
  8. Enable your mod
  9. Click the NEXT button - this is the point your mod tries to load

Look in the log files - any extra messages are your problem!
 
This is what I get in the various log files when starting a modded game with no mods enabled, so all these errors and messages are being generated by Firaxis code so can be ignored when debugging your own mods.

(This is with Gods & Kings and all DLC enabled - the exact messages in your log files will differ depending on how much DLC you have and if you are playing G&K or vanilla.)

database.log
Spoiler :
Code:
[10708.953] constraint failed
[10708.953] While executing - 'INSERT INTO ArtDefine_StrategicView(StrategicViewType, TileType, Asset) VALUES(?,?,?)'
[10711.465] no such table: ContentPackage.LocalizedText
[10714.523] Validating Foreign Key Constraints...
[10714.523] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[10714.523] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[10714.523] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[10715.708] Invalid Reference on UnitGameplay2DScripts.UnitType - "UNIT_HITTITE_WARCHARIOT" does not exist in Units
[10715.708] Invalid Reference on UnitGameplay2DScripts.UnitType - "UNIT_SUMERIAN_PHALANX" does not exist in Units
[10715.708] Failed Validation.
[10716.223] 
-- SQLite Memory Statistics --
Memory Usage:
		[Cur]		[Max]
Malloc:		389024		33247240
PageCache:	4394		4982
LookAside:	0		0
Scratch:	0		1

Static Buffer Overflows:
		[TooLarge]	[NoSpace]
PageCache:	0		29696000
Scratch:	0		0

Largest Allocations:
Malloc:		131072
PageCache:	1160
Scratch:	6640

Prepared Statements:
Current:		10
------------------------------
[12133.398] no such table: ContentPackage.LocalizedText
[12138.094] no such table: ContentPackage.LocalizedText
[12145.286] Validating Foreign Key Constraints...
[12145.286] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[12145.286] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[12145.286] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[12146.503] Failed Validation.
[12146.955] 
-- SQLite Memory Statistics --
Memory Usage:
		[Cur]		[Max]
Malloc:		380448		33247240
PageCache:	4840		4982
LookAside:	0		0
Scratch:	0		1

Static Buffer Overflows:
		[TooLarge]	[NoSpace]
PageCache:	0		29696000
Scratch:	0		0

Largest Allocations:
Malloc:		131072
PageCache:	1160
Scratch:	6640

Prepared Statements:
Current:		8
------------------------------
[12146.986] constraint failed
[12146.986] While executing - 'INSERT INTO Defines(Name, Value) VALUES(?, ?)'

xml.log
Spoiler :
Code:
[10714.507] **** Validating Game Database *****
[10715.708] Performing Localization Checks
[10715.708] Checking Tag Format...
[10715.708] Note: Tags must only use [A-Z_] characters, start with 'TXT_KEY_', and be under 128 characters long.
[10715.708] In table Language_en_US...
[10715.708] Tag (TXT_KEYMODDING_SHOWDLCMODS) does not start with 'TXT_KEY_'
[10715.724] Validating UnitGameplay
[10715.724] Number of selection sounds doesn't match number of units.
[10715.724] Validating Notifications
[10715.724] Number of notification xml entries does not match enum size
[10715.724] **** VALIDATION FAILED *****
[10715.724] Validation Took 1.231383 seconds
[10716.223] **** Validating Prefetch Process *****
[10716.223] **** Validation Success *****
[10716.223] SetGlobalActionInfo
[10716.223] 
-- SQLite Memory Statistics --
Memory Usage:
		[Cur]		[Max]
Malloc:		389024		33247240
PageCache:	4394		4982
LookAside:	0		0
Scratch:	0		1

Static Buffer Overflows:
		[TooLarge]	[NoSpace]
PageCache:	0		29696000
Scratch:	0		0

Largest Allocations:
Malloc:		131072
PageCache:	1160
Scratch:	6640

Prepared Statements:
Current:		10
------------------------------

lua.log
Spoiler :
Code:
[10698.891] Initializing Lua 5.1.4
[12125.848] InstalledPanel: Refreshing Mods
[12125.848] InstalledPanel: GetModBrowserListings()
[12125.988] InstalledPanel: Refreshing Mods
[12213.817] CivilopediaScreen: SetSelectedCategory(12)
[12213.817] CivilopediaScreen: CivilopediaCategory[CategoryTerrain].DisplayList
[12213.926] CivilopediaScreen: SetSelectedCategory(1)
[12213.926] CivilopediaScreen: CivilopediaCategory[CategoryHomePage].DisplayList
[12215.549] Tutorial: Loaded Additional Tutorial checks - Assets\DLC\Expansion\Tutorial\lua\TutorialInclude_Expansion1.lua
[12216.672] GenericPopup: Loaded Popup - Assets\DLC\Expansion\UI\InGame\PopupsGeneric\DeclareWarMovePopup.lua
[12216.672] GenericPopup: Loaded Popup - Assets\DLC\Expansion\UI\InGame\PopupsGeneric\PuppetCityPopup.lua
[12216.672] GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\ConfirmImprovementRebuildPopup.lua
[12216.672] GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\NetworkKickedPopup.lua
[12216.672] GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\CityPlotManagementPopup.lua
[12216.672] GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\ConfirmCommandPopup.lua
[12216.672] GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\MinorCivEnterTerritoryPopup.lua
[12216.672] GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\LiberateMinorPopup.lua
[12216.672] GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\ReturnCivilianPopup.lua
[12216.672] GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\AnnexCityPopup.lua
[12216.672] GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\DeclareWarMovePopup.lua
[12216.672] GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\BarbarianRansomPopup.lua
[12216.672] GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\ConfirmGiftPopup.lua
[12216.672] GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\ConfirmCityTaskPopup.lua
[12216.672] GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\PuppetCityPopup.lua
[12216.672] GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\DeclareWarRangeStrikePopup.lua
[12216.672] GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\ConfirmPolicyBranchPopup.lua
[12216.672] GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\MinorCivGoldPopup.lua
[12218.060] ChoosePantheonPopup: 60
[12218.060] ChoosePantheonPopup: 963
[12218.060] ChoosePantheonPopup: 1023
[12219.277] Demographics: Dequeuing demographics
[12219.277] Demographics: Dequeuing demographics
 
Database.log error

Code:
table Leader_Traits has no column named Type
In Query - insert into Leader_Traits('LeaderType', 'Type') values (?, ?);
In XMLSerializer while updating table Leader_Traits from file XML/Leaders.xml.

Bad XML (in XML/Leaders.xml)

Code:
<Leader_Traits>
  <Row>
    <LeaderType>LEADER_XYZ</LeaderType>
    <[B][COLOR="Red"]Type[/COLOR][/B]>TRAIT_WONDERFUL</[B][COLOR="Red"]Type[/COLOR][/B]>
  </Row>
</Leader_Traits>

Corrected XML

Code:
<Leader_Traits>
  <Row>
    <LeaderType>LEADER_XYZ</LeaderType>
    <[B][COLOR="Green"]TraitType[/COLOR][/B]>TRAIT_WONDERFUL</[B][COLOR="Green"]TraitType[/COLOR][/B]>
  </Row>
</Leader_Traits>
 
Database.log error

Code:
Invalid Reference on Civilization_SpyNames.SpyName - "John Doe" does not exist in Language_en_US

Bad XML

Code:
<Civilization_SpyNames>
  <Row>
    <CivilizationType>CIVILIZATION_XYZ</CivilizationType>
    <SpyName>[COLOR="Red"]John Doe[/COLOR]</SpyName>
  </Row>
</Civilization_SpyNames>

Corrected XML

Code:
<Civilization_SpyNames>
  <Row>
    <CivilizationType>CIVILIZATION_XYZ</CivilizationType>
    <SpyName>[COLOR="Green"]TXT_KEY_XYZ_SPY_JOHN_DOE[/COLOR]</SpyName>
  </Row>
</Civilization_SpyNames>
[COLOR="Green"]<Language_en_US>
  <Row Tag="TXT_KEY_XYZ_SPY_JOHN_DOE">
    <Text>John Doe</Text>
  </Row>
</Language_en_US>[/COLOR]
 
Sorry, wrong thread ! Had several open and replied on the wrong one ...
 
whoward69 (or anybody else) why is "ValidateGameDatabase = 1" necessary? I've been modding for quite some time and it's been set to 0 the whole time (at least I think so).
 
Without ValidateGameDatabase=1 the following will report no errors in any logs

Code:
<GameData>
	<Traits>
		<Row>
			<Type>TRAIT_AAAAAAAAAAB</Type>
			<Description>TXT_KEY_TRAIT_AAAAAAAAAAB</Description>
			<ShortDescription>TXT_KEY_TRAIT_AAAAAAAAAAB_SHORT</ShortDescription>
		</Row>
	</Traits>

	<Language_en_US>
		<Row Tag="TXT_KEY_TRAIT_AAAAAAAAAB">
			<Text>ABC</Text>
		</Row>
		<Row Tag="TXT_KEY_TRAIT_AAAAAAAAAB">
			<Text>A then B then C</Text>
		</Row>
	</Language_en_US>
</GameData>
 
What does this error mean?

It seems like it's saying I need to put in values for these but I have values.
[520071.109] In Query - insert into Traits('Type', 'Description', 'ShortDescription', 'NumTradeRoutesModifier', 'TradeRouteSeaDistanceModifier', 'TradeReligionModifier', 'ExtraSpies', 'WonderProductionModifier', 'LuxuryHappinessRetention') values (?, ?, ?, ?, ?, ?, ?, ?, ?);
[520071.109] In XMLSerializer while updating table Traits from file xml/Trait/TradeExpansion.xml.
 
What does this error mean?

It seems like it's saying I need to put in values for these but I have values.
[520071.109] In Query - insert into Traits('Type', 'Description', 'ShortDescription', 'NumTradeRoutesModifier', 'TradeRouteSeaDistanceModifier', 'TradeReligionModifier', 'ExtraSpies', 'WonderProductionModifier', 'LuxuryHappinessRetention') values (?, ?, ?, ?, ?, ?, ?, ?, ?);
[520071.109] In XMLSerializer while updating table Traits from file xml/Trait/TradeExpansion.xml.

These are actually time-stamps: [520071.109]

There should generally be at least one more line above the two quoted that will have the same time-stamp. It is really needed in order to know what is causing the fault. From the information you have posted, there is an unacceptable value given in table <Traits> within file xml/Trait/TradeExpansion.xml. Without having that other associated error-line to look at I would make a wild guess that what you are using for column <Type> is not unique to all other uses of <Type> within table <Traits> from all expansions you have, all DLC civs you have, and all other mods that may be loading into the game before your mod attempts to load.
 
Hey ,thanks for helping us :D
I follow your instructions and I get the following data yield in my Database.log
Spoiler :
[37719.637] Database::XMLSerializer (XML/Civilization/BrutiiCIV.xml): 'Row' or 'Delete' expected, got 'CivilizationType'.
[37719.700] column Type is not unique
[37719.700]
[37719.700] In XMLSerializer while inserting row into table insert into Units('Type', 'Description', 'Civilopedia', 'Strategy', 'Help', 'Requirements', 'Combat', 'RangedCombat', 'Cost', 'FaithCost', 'RequiresFaithPurchaseEnabled', 'Moves', 'Immobile', 'Range', 'BaseSightRange', 'Class', 'Special', 'Capture', 'CombatClass', 'Domain', 'CivilianAttackPriority', 'DefaultUnitAI', 'Food', 'NoBadGoodies', 'RivalTerritory', 'MilitarySupport', 'MilitaryProduction', 'Pillage', 'PillagePrereqTech', 'Found', 'FoundAbroad', 'CultureBombRadius', 'GoldenAgeTurns', 'FreePolicies', 'OneShotTourism', 'OneShotTourismPercentOthers', 'IgnoreBuildingDefense', 'PrereqResources', 'Mechanized', 'Suicide', 'CaptureWhileEmbarked', 'PrereqTech', 'ObsoleteTech', 'GoodyHutUpgradeUnitClass', 'HurryCostModifier', 'AdvancedStartCost', 'MinAreaSize', 'AirInterceptRange', 'AirUnitCap', 'NukeDamageLevel', 'WorkRate', 'NumFreeTechs', 'BaseBeakersTurnsToCount', 'BaseCultureTurnsToCount', 'RushBuilding', 'BaseHurry', 'HurryMultiplier', 'BaseGold', 'NumGoldPerEra', 'SpreadReligion', 'RemoveHeresy', 'ReligionSpreads', 'ReligiousStrength', 'FoundReligion', 'RequiresEnhancedReligion', 'ProhibitsSpread', 'CanBuyCityState', 'CombatLimit', 'RangeAttackOnlyInDomain', 'RangeAttackIgnoreLOS', 'Trade', 'NumExoticGoods', 'RangedCombatLimit', 'XPValueAttack', 'XPValueDefense', 'SpecialCargo', 'DomainCargo', 'Conscription', 'ExtraMaintenanceCost', 'NoMaintenance', 'Unhappiness', 'UnitArtInfo', 'UnitArtInfoCulturalVariation', 'UnitArtInfoEraVariation', 'ProjectPrereq', 'SpaceshipProject', 'LeaderPromotion', 'LeaderExperience', 'DontShowYields', 'ShowInPedia', 'MoveRate', 'UnitFlagIconOffset', 'PortraitIndex', 'IconAtlas', 'UnitFlagAtlas') with values (UNIT_ROMAN_BALLISTA, TXT_KEY_UNIT_ROMAN_BALLISTA, TXT_KEY_CIV5_ANTIQUITY_BALLISTA_TEXT, TXT_KEY_UNIT_ROMAN_BALLISTA_STRATEGY, TXT_KEY_UNIT_HELP_BALLISTA, , 8, 10, 75, 150, 1, 2, 0, 2, 2, UNITCLASS_CATAPULT, , , UNITCOMBAT_SIEGE, DOMAIN_LAND, , UNITAI_CITY_BOMBARD, 0, 0, 0, 1, 1, 1, , 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, TECH_MATHEMATICS, TECH_PHYSICS, UNITCLASS_TREBUCHET, 20, 20, -1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 3, 3, , , 0, 0, 0, 0, ART_DEF_UNIT_U_ROMAN_BALLISTA, 0, 0, , , , 0, 0, 1, ARTILLERY, 22, 22, UNIT_ATLAS_1, UNIT_FLAG_ATLAS, ).
[37719.700] In XMLSerializer while updating table Units from file XML/Civilization/BrutiiUNIQUES.xml.
[37719.700] column Type is not unique
[37721.072] Validating Foreign Key Constraints...
[37721.088] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[37721.088] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[37721.088] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[37721.088] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[37721.088] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[37721.088] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[37721.088] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[37721.088] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[37721.088] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[37724.707] Failed Validation.

I can't seem to find the CivilizationType that need to be replaced by a row or sometin' else. Also what does the ''ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes'' means ?

Should I post the BrutiiCIV.xml ?
Thanks in advance. :c5influence:
 
Should I post the BrutiiCIV.xml?
Best to start your own thread in the main C&C forum, but the important bit is

Code:
 'Row' or 'Delete' expected, got 'CivilizationType'

you've done something like

Code:
<Civilizations>
    <Type>CIVILIZATION_MY_CIV</Type>
    ...
<Civilizations>
and omitted the <Row> tags
Code:
<Civilizations>
    <Row>
        <Type>CIVILIZATION_MY_CIV</Type>
        ...
    </Row>
<Civilizations>

The other one
Code:
column Type is not unique
is because you are duplicating the unit UNIT_ROMAN_BALLISTA

If you follow all the steps in the first post, you'll note that
Code:
Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
is a "standard" error, so not something you need to fix
 
Okay, any resources you can suggest on next steps? Everything about my civ works, except the traits, which depend on lua scripts. I've been over the code a dozen times, the UI addins are there, the lua logs produce nothing. I'm at a loss and would appreciate any ideas on how to identify the problem.
 
Start a thread on the main C&C forum and attach your mod so that people can look at it and figure out what is wrong. whoward69's zip your mods and attach tutorial. Attaching the mod here on this tutorial thread would simply divert the tutorial from its intended purpose and would not be fair to future users.
 
Top Bottom