silence output by default in release mode for things we can't do much about on a live server... TODO: @cekis can we find a nice way of silencing or outputting java stack dumps into a file instead of the console?

This commit is contained in:
DarthArgus
2016-12-09 21:02:00 +00:00
parent bf396ac2a2
commit 802af495dc
12 changed files with 64 additions and 46 deletions
@@ -105,7 +105,7 @@ AiMovementPatrol::AiMovementPatrol( AICreatureController * controller, std::vect
else
{
m_patrolPath.clear();
WARNING(true, ("AiMovementPatrol unable to find path node %s for object %s",
DEBUG_WARNING(true, ("AiMovementPatrol unable to find path node %s for object %s",
Unicode::wideToNarrow(pointName).c_str(),
owner->getNetworkId().getValueString().c_str()));
break;
@@ -842,7 +842,7 @@ bool AICreatureController::wander( float minDistance, float maxDistance, float m
{
if (isRetreating())
{
WARNING(true, ("AICreatureController::wander() owner(%s) minDistance(%.2f) maxDistance(%.2f) minAngle(%.2f) maxAngle(%.2f) minDelay(%.2f) maxDelay(%.2f) Trying to wander while retreating, failing request.", getDebugInformation().c_str(), minDistance, maxDistance, minAngle, maxAngle, minDelay, maxDelay));
DEBUG_WARNING(true, ("AICreatureController::wander() owner(%s) minDistance(%.2f) maxDistance(%.2f) minAngle(%.2f) maxAngle(%.2f) minDelay(%.2f) maxDelay(%.2f) Trying to wander while retreating, failing request.", getDebugInformation().c_str(), minDistance, maxDistance, minAngle, maxAngle, minDelay, maxDelay));
return false;
}
@@ -876,7 +876,7 @@ void AICreatureController::loiter(CellProperty const * homeCell, Vector const &
{
if (isRetreating())
{
WARNING(true, ("AICreatureController::loiter() owner(%s) cell(%s) home(%.0f, %.0f, %.0f) distance[%.2f...%.2f] delay[%.0f...%.0f] Trying to loiter while retreating, failing request.", getDebugInformation().c_str(), ((homeCell != nullptr) ? homeCell->getCellName() : "nullptr"), home_p.x, home_p.y, home_p.z, minDistance, maxDistance, minDelay, maxDelay));
DEBUG_WARNING(true, ("AICreatureController::loiter() owner(%s) cell(%s) home(%.0f, %.0f, %.0f) distance[%.2f...%.2f] delay[%.0f...%.0f] Trying to loiter while retreating, failing request.", getDebugInformation().c_str(), ((homeCell != nullptr) ? homeCell->getCellName() : "nullptr"), home_p.x, home_p.y, home_p.z, minDistance, maxDistance, minDelay, maxDelay));
return;
}
@@ -892,7 +892,7 @@ void AICreatureController::loiter(NetworkId const & homeId, float const minDista
{
if (isRetreating())
{
WARNING(true, ("AICreatureController::loiter() owner(%s) home(%s) distance[%.2f...%.2f] delay[%.0f...%.0f] Trying to loiter while retreating, failing request.", getDebugInformation().c_str(), homeId.getValueString().c_str(), minDistance, maxDistance, minDelay, maxDelay));
DEBUG_WARNING(true, ("AICreatureController::loiter() owner(%s) home(%s) distance[%.2f...%.2f] delay[%.0f...%.0f] Trying to loiter while retreating, failing request.", getDebugInformation().c_str(), homeId.getValueString().c_str(), minDistance, maxDistance, minDelay, maxDelay));
return;
}
@@ -910,7 +910,7 @@ void AICreatureController::moveTo(CellProperty const * cell, Vector const & targ
{
if (isRetreating())
{
WARNING(true, ("AICreatureController::moveTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f) radius(%.2f) Trying to moveTo while retreating, failing request.", getDebugInformation().c_str(), ((cell != nullptr) ? cell->getCellName() : "nullptr"), target_p.x, target_p.y, target_p.z, radius));
DEBUG_WARNING(true, ("AICreatureController::moveTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f) radius(%.2f) Trying to moveTo while retreating, failing request.", getDebugInformation().c_str(), ((cell != nullptr) ? cell->getCellName() : "nullptr"), target_p.x, target_p.y, target_p.z, radius));
return;
}
@@ -949,7 +949,7 @@ void AICreatureController::moveTo(Unicode::String const & targetName)
{
if (isRetreating())
{
WARNING(true, ("AICreatureController::moveTo() owner(%s) target(%s) Trying to moveTo while retreating, failing request.", getDebugInformation().c_str(), Unicode::wideToNarrow(targetName).c_str()));
DEBUG_WARNING(true, ("AICreatureController::moveTo() owner(%s) target(%s) Trying to moveTo while retreating, failing request.", getDebugInformation().c_str(), Unicode::wideToNarrow(targetName).c_str()));
return;
}
@@ -984,7 +984,7 @@ void AICreatureController::patrol( std::vector<Location> const & locations, bool
{
if (isRetreating())
{
WARNING(true, ("AICreatureController::patrol() owner(%s) Trying to patrol while retreating, failing request.", getDebugInformation().c_str()));
DEBUG_WARNING(true, ("AICreatureController::patrol() owner(%s) Trying to patrol while retreating, failing request.", getDebugInformation().c_str()));
return;
}
@@ -1018,7 +1018,7 @@ void AICreatureController::patrol( std::vector<Unicode::String> const & location
{
if (isRetreating())
{
WARNING(true, ("AICreatureController::patrol() owner(%s) Trying to patrol while retreating, failing request.", getDebugInformation().c_str()));
DEBUG_WARNING(true, ("AICreatureController::patrol() owner(%s) Trying to patrol while retreating, failing request.", getDebugInformation().c_str()));
return;
}
@@ -1052,7 +1052,7 @@ void AICreatureController::stop()
{
if (isRetreating())
{
WARNING(true, ("AICreatureController::stop() owner(%s) Trying to stop while retreating, failing request.", getDebugInformation().c_str()));
DEBUG_WARNING(true, ("AICreatureController::stop() owner(%s) Trying to stop while retreating, failing request.", getDebugInformation().c_str()));
return;
}
@@ -1071,7 +1071,7 @@ bool AICreatureController::faceTo(CellProperty const * targetCell, Vector const
{
if (isRetreating())
{
WARNING(true, ("AICreatureController::faceTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f) Trying to faceTo while retreating, failing faceTo request.", getDebugInformation().c_str(), ((targetCell != nullptr) ? targetCell->getCellName() : "nullptr"), target_p.x, target_p.y, target_p.z));
DEBUG_WARNING(true, ("AICreatureController::faceTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f) Trying to faceTo while retreating, failing faceTo request.", getDebugInformation().c_str(), ((targetCell != nullptr) ? targetCell->getCellName() : "nullptr"), target_p.x, target_p.y, target_p.z));
return false;
}
@@ -1110,7 +1110,7 @@ bool AICreatureController::faceTo( NetworkId const & targetId )
{
if (isRetreating())
{
WARNING(true, ("AICreatureController::faceTo() owner(%s) Trying to faceTo the target(%s) while retreating, failing request.", getDebugInformation().c_str(), targetId.getValueString().c_str()));
DEBUG_WARNING(true, ("AICreatureController::faceTo() owner(%s) Trying to faceTo the target(%s) while retreating, failing request.", getDebugInformation().c_str(), targetId.getValueString().c_str()));
return false;
}
@@ -1155,7 +1155,7 @@ bool AICreatureController::follow( NetworkId const & targetId, float minDistance
{
if (isRetreating())
{
WARNING(true, ("AICreatureController::follow() owner(%s) distance[%.2f...%.2f] Trying to follow the target(%s) while retreating, failing request.", getDebugInformation().c_str(), minDistance, maxDistance, targetId.getValueString().c_str()));
DEBUG_WARNING(true, ("AICreatureController::follow() owner(%s) distance[%.2f...%.2f] Trying to follow the target(%s) while retreating, failing request.", getDebugInformation().c_str(), minDistance, maxDistance, targetId.getValueString().c_str()));
return false;
}
@@ -1203,7 +1203,7 @@ bool AICreatureController::follow( NetworkId const & targetId, Vector const & of
{
if (isRetreating())
{
WARNING(true, ("AICreatureController::follow() owner(%s) offset(%.0f, %.0f, %.0f) Trying to follow the target(%s) while retreating, failing request.", getDebugInformation().c_str(), offset.x, offset.y, offset.z, targetId.getValueString().c_str()));
DEBUG_WARNING(true, ("AICreatureController::follow() owner(%s) offset(%.0f, %.0f, %.0f) Trying to follow the target(%s) while retreating, failing request.", getDebugInformation().c_str(), offset.x, offset.y, offset.z, targetId.getValueString().c_str()));
return false;
}
@@ -1254,7 +1254,7 @@ bool AICreatureController::swarm( NetworkId const & targetId )
{
if (isRetreating())
{
WARNING(true, ("AICreatureController::swarm() owner(%s) Trying to flee the target(%s) while retreating, failing request.", getDebugInformation().c_str(), targetId.getValueString().c_str()));
DEBUG_WARNING(true, ("AICreatureController::swarm() owner(%s) Trying to flee the target(%s) while retreating, failing request.", getDebugInformation().c_str(), targetId.getValueString().c_str()));
return false;
}
@@ -1290,7 +1290,7 @@ bool AICreatureController::swarm( NetworkId const & targetId, float offset )
{
if (isRetreating())
{
WARNING(true, ("AICreatureController::swarm() owner(%s) offset(%.2f) Trying to flee the target(%s) while retreating, failing request.", getDebugInformation().c_str(), offset, targetId.getValueString().c_str()));
DEBUG_WARNING(true, ("AICreatureController::swarm() owner(%s) offset(%.2f) Trying to flee the target(%s) while retreating, failing request.", getDebugInformation().c_str(), offset, targetId.getValueString().c_str()));
return false;
}
@@ -1314,7 +1314,7 @@ bool AICreatureController::flee( NetworkId const & targetId, float minDistance,
{
if (isRetreating())
{
WARNING(true, ("AICreatureController::flee() owner(%s) distance[%.2f...%.2f] Trying to flee the target(%s) while retreating, failing request.", getDebugInformation().c_str(), minDistance, maxDistance, targetId.getValueString().c_str(), targetId.getValueString().c_str()));
DEBUG_WARNING(true, ("AICreatureController::flee() owner(%s) distance[%.2f...%.2f] Trying to flee the target(%s) while retreating, failing request.", getDebugInformation().c_str(), minDistance, maxDistance, targetId.getValueString().c_str(), targetId.getValueString().c_str()));
return false;
}
@@ -2411,7 +2411,7 @@ NetworkId AICreatureController::createWeapon(char const * const functionName, Cr
{
if (required)
{
WARNING(required, ("debug_ai: AICreatureController::%s() A required weapon is specified as ""none"" for (%s), defaulting to ""unarmed""", functionName, getDebugInformation().c_str()));
DEBUG_WARNING(required, ("debug_ai: AICreatureController::%s() A required weapon is specified as ""none"" for (%s), defaulting to ""unarmed""", functionName, getDebugInformation().c_str()));
result = getUnarmedWeapon();
}
else
@@ -707,7 +707,7 @@ bool ContainerInterface::transferItemToSlottedContainer(ServerObject &destinatio
if (arrangementIndex < 0)
{
WARNING_STRICT_FATAL(true, ("Invaid arrangement index in transferItemToSlottedContainer"));
DEBUG_WARNING(true, ("Invaid arrangement index in transferItemToSlottedContainer"));
error = Container::CEC_InvalidArrangement;
return false;
}
@@ -50,9 +50,13 @@ ServerObject * ServerWorld::createObjectFromTemplate(uint32 templateCrc, const N
objectTemplate = ObjectTemplateList::fetch(templateCrc);
}
WARNING(!objectTemplate, ("Missing Template! Can't create object from "
"template crc %lu(%s), file not found", templateCrc,
ObjectTemplateList::lookUp(templateCrc).getString()));
if (!objectTemplate) {
DEBUG_WARNING(!objectTemplate, ("Missing Template! Can't create object from "
"template crc %lu(%s), file not found", templateCrc,
ObjectTemplateList::lookUp(templateCrc).getString()));
return 0;
}
Object *object = nullptr;
if (objectTemplate)
@@ -599,8 +599,8 @@ void ServerObject::MoveNotification::checkForGoldObject(const Object &object) co
{
if (ConfigServerGame::getMaxGoldNetworkId()!=NetworkId::cms_invalid && object.getNetworkId() < ConfigServerGame::getMaxGoldNetworkId())
{
FATAL(ConfigServerGame::getFatalOnMovingGoldObject(),("Attempted to move object %s, which is a gold object that should not be movable.", object.getNetworkId().getValueString().c_str()));
WARNING(true,("Attempted to move object %s, which is a gold object that should not be movable.", object.getNetworkId().getValueString().c_str()));
DEBUG_FATAL(ConfigServerGame::getFatalOnMovingGoldObject(),("Attempted to move object %s, which is a gold object that should not be movable.", object.getNetworkId().getValueString().c_str()));
DEBUG_WARNING(true,("Attempted to move object %s, which is a gold object that should not be movable.", object.getNetworkId().getValueString().c_str()));
}
}
@@ -2528,7 +2528,7 @@ bool ServerObject::serverObjectInitializeFirstTimeObject(ServerObject *cell, Tra
Container::ContainerErrorCode tmp = Container::CEC_Success;
if (!ContainerInterface::transferItemToCell(*cell, *this, transform, nullptr, tmp))
{
WARNING(true, ("ServerWorld::createNewObjectIntermediate tried to create a new object in a cell, but it failed."));
DEBUG_WARNING(true, ("ServerWorld::createNewObjectIntermediate tried to create a new object in a cell, but it failed."));
return false;
}
}
@@ -1444,7 +1444,7 @@ void ShipObject::constructFromTemplate()
ShipChassis const * shipChassis = ShipChassis::findShipChassisByName (TemporaryCrcString (shipType.c_str (), true));
if (shipChassis == nullptr)
{
WARNING (true, ("ShipObject::constructFromTemplate failed to find a valid ship chassis for [%s], trying generic", shipType.c_str ()));
DEBUG_WARNING (true, ("ShipObject::constructFromTemplate failed to find a valid ship chassis for [%s], trying generic", shipType.c_str ()));
shipChassis = ShipChassis::findShipChassisByName (TemporaryCrcString ("generic", true));
}
@@ -1452,7 +1452,7 @@ void ShipObject::constructFromTemplate()
m_chassisType = shipChassis->getCrc ();
else
{
WARNING (true, ("ShipObject::constructFromTemplate failed to find a valid ship chassis for [%s] or generic", shipType.c_str ()));
DEBUG_WARNING (true, ("ShipObject::constructFromTemplate failed to find a valid ship chassis for [%s] or generic", shipType.c_str ()));
}
//set initial slot targetability from the chassis setttings. Code or script can change these at runtime
@@ -73,6 +73,7 @@ void ConfigServerScript::install(void)
KEY_BOOL (allowDebugSpeakMessages, true);
KEY_BOOL (disableScriptLogs, false);
KEY_BOOL (logBalance, false);
KEY_BOOL (printStacks, false);
int index = 0;
char const * result = 0;
@@ -17,16 +17,17 @@ class ConfigServerScript
struct Data
{
// script data
// script data
const char * scriptPath; // location of scripts
const char * javaLibPath; // location of jvm files
const char * javaDebugPort; // ip port we connect to for remote debugging
bool useRemoteDebugJava; // flag to use the jvm for remote debugging
bool allowBuildClusterScriptAttach; //used only on the build cluster for attaching scripts without a VM.
bool allowDebugConsoleMessages; //used only on the build cluster for attaching scripts without a VM.
bool allowDebugSpeakMessages; //used to enable/disable the debugSpeakMessage script function
bool disableScriptLogs;
bool logBalance;
bool useRemoteDebugJava; // flag to use the jvm for remote debugging
bool allowBuildClusterScriptAttach; //used only on the build cluster for attaching scripts without a VM.
bool allowDebugConsoleMessages; //used only on the build cluster for attaching scripts without a VM.
bool allowDebugSpeakMessages; //used to enable/disable the debugSpeakMessage script function
bool disableScriptLogs;
bool logBalance;
bool printStacks;
};
private:
@@ -42,15 +43,17 @@ class ConfigServerScript
static const char * getJavaLibPath (void);
static const char * getJavaDebugPort (void);
static bool getUseRemoteDebugJava (void);
static bool getAllowBuildClusterScriptAttach();
static bool allowDebugConsoleMessages();
static bool allowDebugSpeakMessages();
static bool getDisableScriptLogs();
static bool getLogBalance();
static bool getAllowBuildClusterScriptAttach();
static bool allowDebugConsoleMessages();
static bool allowDebugSpeakMessages();
static bool getDisableScriptLogs();
static bool getLogBalance();
static bool hasJavaOptions();
static int getNumberOfJavaOptions();
static char const * getJavaOptions(int index);
static bool getPrintStacks();
static bool hasJavaOptions();
static int getNumberOfJavaOptions();
static char const * getJavaOptions(int index);
};
inline const char *ConfigServerScript::getScriptPath(void)
@@ -112,6 +115,15 @@ inline bool ConfigServerScript::getLogBalance()
return data->logBalance;
}
inline bool ConfigServerScript::getPrintStacks()
{
#ifdef _DEBUG
return true;
#else
return data->printStacks;
#endif
}
//-----------------------------------------------------------------------
@@ -2183,7 +2183,8 @@ jlong JavaLibrary::getFreeJavaMemory()
*/
void JavaLibrary::printJavaStack()
{
ms_env->CallStaticVoidMethod(ms_clsThread, ms_midThreadDumpStack);
if (ConfigServerScript::getPrintStacks())
ms_env->CallStaticVoidMethod(ms_clsThread, ms_midThreadDumpStack);
}
/**
@@ -71,7 +71,7 @@ Floor * FloorManager::createFloor ( const char * floorMeshFilename, Object const
if(!pMesh)
{
WARNING(true, ("Could not find floor mesh %s", floorMeshFilename));
DEBUG_WARNING(true, ("Could not find floor mesh %s", floorMeshFilename));
return nullptr;
}
@@ -134,7 +134,7 @@ void ArrangementDescriptor::load_0000(Iff &iff)
// convert slot name to SlotId
const SlotId slotId = SlotIdManager::findSlotId(slotName);
if (slotId == SlotId::invalid)
WARNING(true, ("ArrangementDescriptor [%s] specified invalid slot name [%s], ignoring", m_name->getString(), slotName.getString()));
DEBUG_WARNING(true, ("ArrangementDescriptor [%s] specified invalid slot name [%s], ignoring", m_name->getString(), slotName.getString()));
else
arrangement.push_back(slotId);
}
@@ -449,11 +449,11 @@ void CellProperty::initialize(const PortalProperty &portalProperty, int cellInde
if (cellTemplate.getFloorName())
{
m_floor = FloorManager::createFloor(cellTemplate.getFloorName(),&getOwner(),nullptr,false);
WARNING(!m_floor, ("Cell %s could not load floor %s", cellTemplate.getAppearanceName(), cellTemplate.getFloorName()));
DEBUG_WARNING(!m_floor, ("Cell %s could not load floor %s", cellTemplate.getAppearanceName(), cellTemplate.getFloorName()));
}
else
{
WARNING(true, ("Cell %s has no floor", cellTemplate.getAppearanceName()));
DEBUG_WARNING(true, ("Cell %s has no floor", cellTemplate.getAppearanceName()));
}
m_cellIndex = cellIndex;