Add more information to warnings logged when asset names and descriptions have to be truncated for database storage

On balance, I still think this is useful because asset names and descriptions can sometimes be helpful in determining what things are.
Even though they are never subsequently (inventory names/descriptions are always used instead).
0.7.4-extended
Justin Clark-Casey (justincc) 2013-02-27 21:35:54 +00:00
parent 93d16b90a4
commit fd501ae45f
3 changed files with 18 additions and 6 deletions

View File

@ -163,14 +163,18 @@ namespace OpenSim.Data.MSSQL
if (asset.Name.Length > 64) if (asset.Name.Length > 64)
{ {
assetName = asset.Name.Substring(0, 64); assetName = asset.Name.Substring(0, 64);
m_log.Warn("[ASSET DB]: Name field truncated from " + asset.Name.Length + " to " + assetName.Length + " characters on add"); m_log.WarnFormat(
"[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
asset.Name, asset.ID, asset.Name.Length, assetName.Length);
} }
string assetDescription = asset.Description; string assetDescription = asset.Description;
if (asset.Description.Length > 64) if (asset.Description.Length > 64)
{ {
assetDescription = asset.Description.Substring(0, 64); assetDescription = asset.Description.Substring(0, 64);
m_log.Warn("[ASSET DB]: Description field truncated from " + asset.Description.Length + " to " + assetDescription.Length + " characters on add"); m_log.WarnFormat(
"[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
} }
using (SqlConnection conn = new SqlConnection(m_connectionString)) using (SqlConnection conn = new SqlConnection(m_connectionString))

View File

@ -173,14 +173,18 @@ namespace OpenSim.Data.MySQL
if (asset.Name.Length > 64) if (asset.Name.Length > 64)
{ {
assetName = asset.Name.Substring(0, 64); assetName = asset.Name.Substring(0, 64);
m_log.Warn("[ASSET DB]: Name field truncated from " + asset.Name.Length + " to " + assetName.Length + " characters on add"); m_log.WarnFormat(
"[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
asset.Name, asset.ID, asset.Name.Length, assetName.Length);
} }
string assetDescription = asset.Description; string assetDescription = asset.Description;
if (asset.Description.Length > 64) if (asset.Description.Length > 64)
{ {
assetDescription = asset.Description.Substring(0, 64); assetDescription = asset.Description.Substring(0, 64);
m_log.Warn("[ASSET DB]: Description field truncated from " + asset.Description.Length + " to " + assetDescription.Length + " characters on add"); m_log.WarnFormat(
"[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
} }
try try

View File

@ -204,14 +204,18 @@ namespace OpenSim.Data.MySQL
if (asset.Name.Length > 64) if (asset.Name.Length > 64)
{ {
assetName = asset.Name.Substring(0, 64); assetName = asset.Name.Substring(0, 64);
m_log.Warn("[XASSET DB]: Name field truncated from " + asset.Name.Length + " to " + assetName.Length + " characters on add"); m_log.WarnFormat(
"[XASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
asset.Name, asset.ID, asset.Name.Length, assetName.Length);
} }
string assetDescription = asset.Description; string assetDescription = asset.Description;
if (asset.Description.Length > 64) if (asset.Description.Length > 64)
{ {
assetDescription = asset.Description.Substring(0, 64); assetDescription = asset.Description.Substring(0, 64);
m_log.Warn("[XASSET DB]: Description field truncated from " + asset.Description.Length + " to " + assetDescription.Length + " characters on add"); m_log.WarnFormat(
"[XASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
} }
if (m_enableCompression) if (m_enableCompression)