diff options
author | Jeff Ames | 2008-02-05 19:44:27 +0000 |
---|---|---|
committer | Jeff Ames | 2008-02-05 19:44:27 +0000 |
commit | 6ed5283bc06a62f38eb517e67b975832b603bf61 (patch) | |
tree | e5f635018789b73a99ddeca0883a68368fa5eece /OpenSim/Framework/Data.SQLite/SQLiteRegionData.cs | |
parent | Cut down on the number of packets sent during terraforming. Terraforming shou... (diff) | |
download | opensim-SC-6ed5283bc06a62f38eb517e67b975832b603bf61.zip opensim-SC-6ed5283bc06a62f38eb517e67b975832b603bf61.tar.gz opensim-SC-6ed5283bc06a62f38eb517e67b975832b603bf61.tar.bz2 opensim-SC-6ed5283bc06a62f38eb517e67b975832b603bf61.tar.xz |
Converted logging to use log4net.
Changed LogBase to ConsoleBase, which handles console I/O.
This is mostly an in-place conversion, so lots of refactoring can still be done.
Diffstat (limited to 'OpenSim/Framework/Data.SQLite/SQLiteRegionData.cs')
-rw-r--r-- | OpenSim/Framework/Data.SQLite/SQLiteRegionData.cs | 78 |
1 files changed, 40 insertions, 38 deletions
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteRegionData.cs b/OpenSim/Framework/Data.SQLite/SQLiteRegionData.cs index 0afc0ce..69dc3f5 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteRegionData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteRegionData.cs | |||
@@ -42,6 +42,8 @@ namespace OpenSim.Framework.Data.SQLite | |||
42 | { | 42 | { |
43 | public class SQLiteRegionData : IRegionDataStore | 43 | public class SQLiteRegionData : IRegionDataStore |
44 | { | 44 | { |
45 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||
46 | |||
45 | private const string primSelect = "select * from prims"; | 47 | private const string primSelect = "select * from prims"; |
46 | private const string shapeSelect = "select * from primshapes"; | 48 | private const string shapeSelect = "select * from primshapes"; |
47 | private const string itemsSelect = "select * from primitems"; | 49 | private const string itemsSelect = "select * from primitems"; |
@@ -78,7 +80,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
78 | 80 | ||
79 | ds = new DataSet(); | 81 | ds = new DataSet(); |
80 | 82 | ||
81 | MainLog.Instance.Verbose("DATASTORE", "Sqlite - connecting: " + connectionString); | 83 | m_log.Info("[DATASTORE]: Sqlite - connecting: " + connectionString); |
82 | m_conn = new SqliteConnection(m_connectionString); | 84 | m_conn = new SqliteConnection(m_connectionString); |
83 | m_conn.Open(); | 85 | m_conn.Open(); |
84 | 86 | ||
@@ -142,7 +144,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
142 | } | 144 | } |
143 | catch (Exception) | 145 | catch (Exception) |
144 | { | 146 | { |
145 | MainLog.Instance.Verbose("DATASTORE", "Caught fill error on primshapes table"); | 147 | m_log.Info("[DATASTORE]: Caught fill error on primshapes table"); |
146 | } | 148 | } |
147 | 149 | ||
148 | try | 150 | try |
@@ -151,7 +153,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
151 | } | 153 | } |
152 | catch (Exception) | 154 | catch (Exception) |
153 | { | 155 | { |
154 | MainLog.Instance.Verbose("DATASTORE", "Caught fill error on terrain table"); | 156 | m_log.Info("[DATASTORE]: Caught fill error on terrain table"); |
155 | } | 157 | } |
156 | 158 | ||
157 | try | 159 | try |
@@ -160,7 +162,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
160 | } | 162 | } |
161 | catch (Exception) | 163 | catch (Exception) |
162 | { | 164 | { |
163 | MainLog.Instance.Verbose("DATASTORE", "Caught fill error on land table"); | 165 | m_log.Info("[DATASTORE]: Caught fill error on land table"); |
164 | } | 166 | } |
165 | 167 | ||
166 | try | 168 | try |
@@ -169,7 +171,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
169 | } | 171 | } |
170 | catch (Exception) | 172 | catch (Exception) |
171 | { | 173 | { |
172 | MainLog.Instance.Verbose("DATASTORE", "Caught fill error on landaccesslist table"); | 174 | m_log.Info("[DATASTORE]: Caught fill error on landaccesslist table"); |
173 | } | 175 | } |
174 | return; | 176 | return; |
175 | } | 177 | } |
@@ -183,29 +185,29 @@ namespace OpenSim.Framework.Data.SQLite | |||
183 | { | 185 | { |
184 | if ((prim.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) == 0) | 186 | if ((prim.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) == 0) |
185 | { | 187 | { |
186 | MainLog.Instance.Verbose("DATASTORE", "Adding obj: " + obj.UUID + " to region: " + regionUUID); | 188 | m_log.Info("[DATASTORE]: Adding obj: " + obj.UUID + " to region: " + regionUUID); |
187 | addPrim(prim, Util.ToRawUuidString(obj.UUID), Util.ToRawUuidString(regionUUID)); | 189 | addPrim(prim, Util.ToRawUuidString(obj.UUID), Util.ToRawUuidString(regionUUID)); |
188 | } | 190 | } |
189 | else if (prim.Stopped) | 191 | else if (prim.Stopped) |
190 | { | 192 | { |
191 | //MainLog.Instance.Verbose("DATASTORE", | 193 | //m_log.Info("[DATASTORE]: " + |
192 | //"Adding stopped obj: " + obj.UUID + " to region: " + regionUUID); | 194 | //"Adding stopped obj: " + obj.UUID + " to region: " + regionUUID); |
193 | //addPrim(prim, Util.ToRawUuidString(obj.UUID), Util.ToRawUuidString(regionUUID)); | 195 | //addPrim(prim, Util.ToRawUuidString(obj.UUID), Util.ToRawUuidString(regionUUID)); |
194 | } | 196 | } |
195 | else | 197 | else |
196 | { | 198 | { |
197 | // MainLog.Instance.Verbose("DATASTORE", "Ignoring Physical obj: " + obj.UUID + " in region: " + regionUUID); | 199 | // m_log.Info("[DATASTORE]: Ignoring Physical obj: " + obj.UUID + " in region: " + regionUUID); |
198 | } | 200 | } |
199 | } | 201 | } |
200 | } | 202 | } |
201 | 203 | ||
202 | Commit(); | 204 | Commit(); |
203 | // MainLog.Instance.Verbose("Dump of prims:", ds.GetXml()); | 205 | // m_log.Info("[Dump of prims]: " + ds.GetXml()); |
204 | } | 206 | } |
205 | 207 | ||
206 | public void RemoveObject(LLUUID obj, LLUUID regionUUID) | 208 | public void RemoveObject(LLUUID obj, LLUUID regionUUID) |
207 | { | 209 | { |
208 | MainLog.Instance.Verbose("DATASTORE", "Removing obj: {0} from region: {1}", obj.UUID, regionUUID); | 210 | m_log.Info(String.Format("[DATASTORE]: Removing obj: {0} from region: {1}", obj.UUID, regionUUID)); |
209 | 211 | ||
210 | DataTable prims = ds.Tables["prims"]; | 212 | DataTable prims = ds.Tables["prims"]; |
211 | DataTable shapes = ds.Tables["primshapes"]; | 213 | DataTable shapes = ds.Tables["primshapes"]; |
@@ -274,7 +276,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
274 | lock (ds) | 276 | lock (ds) |
275 | { | 277 | { |
276 | DataRow[] primsForRegion = prims.Select(byRegion, orderByParent); | 278 | DataRow[] primsForRegion = prims.Select(byRegion, orderByParent); |
277 | MainLog.Instance.Verbose("DATASTORE", | 279 | m_log.Info("[DATASTORE]: " + |
278 | "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); | 280 | "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); |
279 | 281 | ||
280 | foreach (DataRow primRow in primsForRegion) | 282 | foreach (DataRow primRow in primsForRegion) |
@@ -296,7 +298,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
296 | } | 298 | } |
297 | else | 299 | else |
298 | { | 300 | { |
299 | MainLog.Instance.Notice( | 301 | m_log.Info( |
300 | "No shape found for prim in storage, so setting default box shape"); | 302 | "No shape found for prim in storage, so setting default box shape"); |
301 | prim.Shape = PrimitiveBaseShape.Default; | 303 | prim.Shape = PrimitiveBaseShape.Default; |
302 | } | 304 | } |
@@ -316,7 +318,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
316 | } | 318 | } |
317 | else | 319 | else |
318 | { | 320 | { |
319 | MainLog.Instance.Notice( | 321 | m_log.Info( |
320 | "No shape found for prim in storage, so setting default box shape"); | 322 | "No shape found for prim in storage, so setting default box shape"); |
321 | prim.Shape = PrimitiveBaseShape.Default; | 323 | prim.Shape = PrimitiveBaseShape.Default; |
322 | } | 324 | } |
@@ -330,11 +332,11 @@ namespace OpenSim.Framework.Data.SQLite | |||
330 | } | 332 | } |
331 | catch (Exception e) | 333 | catch (Exception e) |
332 | { | 334 | { |
333 | MainLog.Instance.Error("DATASTORE", "Failed create prim object, exception and data follows"); | 335 | m_log.Error("[DATASTORE]: Failed create prim object, exception and data follows"); |
334 | MainLog.Instance.Verbose("DATASTORE", e.ToString()); | 336 | m_log.Info("[DATASTORE]: " + e.ToString()); |
335 | foreach (DataColumn col in prims.Columns) | 337 | foreach (DataColumn col in prims.Columns) |
336 | { | 338 | { |
337 | MainLog.Instance.Verbose("DATASTORE", "Col: " + col.ColumnName + " => " + primRow[col]); | 339 | m_log.Info("[DATASTORE]: Col: " + col.ColumnName + " => " + primRow[col]); |
338 | } | 340 | } |
339 | } | 341 | } |
340 | } | 342 | } |
@@ -348,7 +350,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
348 | /// <param name="prim"></param> | 350 | /// <param name="prim"></param> |
349 | private void LoadItems(SceneObjectPart prim) | 351 | private void LoadItems(SceneObjectPart prim) |
350 | { | 352 | { |
351 | MainLog.Instance.Verbose("DATASTORE", "Loading inventory for {0}, {1}", prim.Name, prim.UUID); | 353 | m_log.Info(String.Format("[DATASTORE]: Loading inventory for {0}, {1}", prim.Name, prim.UUID)); |
352 | 354 | ||
353 | DataTable dbItems = ds.Tables["primitems"]; | 355 | DataTable dbItems = ds.Tables["primitems"]; |
354 | 356 | ||
@@ -362,7 +364,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
362 | TaskInventoryItem item = buildItem(row); | 364 | TaskInventoryItem item = buildItem(row); |
363 | inventory.Add(item); | 365 | inventory.Add(item); |
364 | 366 | ||
365 | MainLog.Instance.Verbose("DATASTORE", "Restored item {0}, {1}", item.Name, item.ItemID); | 367 | m_log.Info(String.Format("[DATASTORE]: Restored item {0}, {1}", item.Name, item.ItemID)); |
366 | } | 368 | } |
367 | 369 | ||
368 | prim.RestoreInventoryItems(inventory); | 370 | prim.RestoreInventoryItems(inventory); |
@@ -383,7 +385,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
383 | 385 | ||
384 | // the following is an work around for .NET. The perf | 386 | // the following is an work around for .NET. The perf |
385 | // issues associated with it aren't as bad as you think. | 387 | // issues associated with it aren't as bad as you think. |
386 | MainLog.Instance.Verbose("DATASTORE", "Storing terrain revision r" + revision.ToString()); | 388 | m_log.Info("[DATASTORE]: Storing terrain revision r" + revision.ToString()); |
387 | String sql = "insert into terrain(RegionUUID, Revision, Heightfield)" + | 389 | String sql = "insert into terrain(RegionUUID, Revision, Heightfield)" + |
388 | " values(:RegionUUID, :Revision, :Heightfield)"; | 390 | " values(:RegionUUID, :Revision, :Heightfield)"; |
389 | 391 | ||
@@ -446,11 +448,11 @@ namespace OpenSim.Framework.Data.SQLite | |||
446 | } | 448 | } |
447 | else | 449 | else |
448 | { | 450 | { |
449 | MainLog.Instance.Verbose("DATASTORE", "No terrain found for region"); | 451 | m_log.Info("[DATASTORE]: No terrain found for region"); |
450 | return null; | 452 | return null; |
451 | } | 453 | } |
452 | 454 | ||
453 | MainLog.Instance.Verbose("DATASTORE", "Loaded terrain revision r" + rev.ToString()); | 455 | m_log.Info("[DATASTORE]: Loaded terrain revision r" + rev.ToString()); |
454 | } | 456 | } |
455 | } | 457 | } |
456 | return terret; | 458 | return terret; |
@@ -1265,7 +1267,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
1265 | if (!persistPrimInventories) | 1267 | if (!persistPrimInventories) |
1266 | return; | 1268 | return; |
1267 | 1269 | ||
1268 | MainLog.Instance.Verbose("DATASTORE", "Entered StorePrimInventory with prim ID {0}", primID); | 1270 | m_log.Info(String.Format("[DATASTORE]: Entered StorePrimInventory with prim ID {0}", primID)); |
1269 | 1271 | ||
1270 | DataTable dbItems = ds.Tables["primitems"]; | 1272 | DataTable dbItems = ds.Tables["primitems"]; |
1271 | 1273 | ||
@@ -1278,10 +1280,10 @@ namespace OpenSim.Framework.Data.SQLite | |||
1278 | // repalce with current inventory details | 1280 | // repalce with current inventory details |
1279 | foreach (TaskInventoryItem newItem in items) | 1281 | foreach (TaskInventoryItem newItem in items) |
1280 | { | 1282 | { |
1281 | // MainLog.Instance.Verbose( | 1283 | // m_log.Info(String.Format( |
1282 | // "DATASTORE", | 1284 | // "[DATASTORE]: ", |
1283 | // "Adding item {0}, {1} to prim ID {2}", | 1285 | // "Adding item {0}, {1} to prim ID {2}", |
1284 | // newItem.Name, newItem.ItemID, newItem.ParentPartID); | 1286 | // newItem.Name, newItem.ItemID, newItem.ParentPartID)); |
1285 | 1287 | ||
1286 | DataRow newItemRow = dbItems.NewRow(); | 1288 | DataRow newItemRow = dbItems.NewRow(); |
1287 | fillItemRow(newItemRow, newItem); | 1289 | fillItemRow(newItemRow, newItem); |
@@ -1508,7 +1510,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
1508 | } | 1510 | } |
1509 | catch (SqliteSyntaxException) | 1511 | catch (SqliteSyntaxException) |
1510 | { | 1512 | { |
1511 | MainLog.Instance.Warn("SQLITE", "Primitives Table Already Exists"); | 1513 | m_log.Warn("[SQLITE]: Primitives Table Already Exists"); |
1512 | } | 1514 | } |
1513 | 1515 | ||
1514 | try | 1516 | try |
@@ -1517,7 +1519,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
1517 | } | 1519 | } |
1518 | catch (SqliteSyntaxException) | 1520 | catch (SqliteSyntaxException) |
1519 | { | 1521 | { |
1520 | MainLog.Instance.Warn("SQLITE", "Shapes Table Already Exists"); | 1522 | m_log.Warn("[SQLITE]: Shapes Table Already Exists"); |
1521 | } | 1523 | } |
1522 | 1524 | ||
1523 | if (persistPrimInventories) | 1525 | if (persistPrimInventories) |
@@ -1528,7 +1530,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
1528 | } | 1530 | } |
1529 | catch (SqliteSyntaxException) | 1531 | catch (SqliteSyntaxException) |
1530 | { | 1532 | { |
1531 | MainLog.Instance.Warn("SQLITE", "Primitives Inventory Table Already Exists"); | 1533 | m_log.Warn("[SQLITE]: Primitives Inventory Table Already Exists"); |
1532 | } | 1534 | } |
1533 | } | 1535 | } |
1534 | 1536 | ||
@@ -1538,7 +1540,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
1538 | } | 1540 | } |
1539 | catch (SqliteSyntaxException) | 1541 | catch (SqliteSyntaxException) |
1540 | { | 1542 | { |
1541 | MainLog.Instance.Warn("SQLITE", "Terrain Table Already Exists"); | 1543 | m_log.Warn("[SQLITE]: Terrain Table Already Exists"); |
1542 | } | 1544 | } |
1543 | 1545 | ||
1544 | try | 1546 | try |
@@ -1547,7 +1549,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
1547 | } | 1549 | } |
1548 | catch (SqliteSyntaxException) | 1550 | catch (SqliteSyntaxException) |
1549 | { | 1551 | { |
1550 | MainLog.Instance.Warn("SQLITE", "Land Table Already Exists"); | 1552 | m_log.Warn("[SQLITE]: Land Table Already Exists"); |
1551 | } | 1553 | } |
1552 | 1554 | ||
1553 | try | 1555 | try |
@@ -1556,7 +1558,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
1556 | } | 1558 | } |
1557 | catch (SqliteSyntaxException) | 1559 | catch (SqliteSyntaxException) |
1558 | { | 1560 | { |
1559 | MainLog.Instance.Warn("SQLITE", "LandAccessList Table Already Exists"); | 1561 | m_log.Warn("[SQLITE]: LandAccessList Table Already Exists"); |
1560 | } | 1562 | } |
1561 | conn.Close(); | 1563 | conn.Close(); |
1562 | } | 1564 | } |
@@ -1596,7 +1598,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
1596 | } | 1598 | } |
1597 | catch (SqliteSyntaxException) | 1599 | catch (SqliteSyntaxException) |
1598 | { | 1600 | { |
1599 | MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating"); | 1601 | m_log.Info("[DATASTORE]: SQLite Database doesn't exist... creating"); |
1600 | InitDB(conn); | 1602 | InitDB(conn); |
1601 | } | 1603 | } |
1602 | 1604 | ||
@@ -1614,7 +1616,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
1614 | { | 1616 | { |
1615 | if (!tmpDS.Tables["prims"].Columns.Contains(col.ColumnName)) | 1617 | if (!tmpDS.Tables["prims"].Columns.Contains(col.ColumnName)) |
1616 | { | 1618 | { |
1617 | MainLog.Instance.Verbose("DATASTORE", "Missing required column:" + col.ColumnName); | 1619 | m_log.Info("[DATASTORE]: Missing required column:" + col.ColumnName); |
1618 | return false; | 1620 | return false; |
1619 | } | 1621 | } |
1620 | } | 1622 | } |
@@ -1623,7 +1625,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
1623 | { | 1625 | { |
1624 | if (!tmpDS.Tables["primshapes"].Columns.Contains(col.ColumnName)) | 1626 | if (!tmpDS.Tables["primshapes"].Columns.Contains(col.ColumnName)) |
1625 | { | 1627 | { |
1626 | MainLog.Instance.Verbose("DATASTORE", "Missing required column:" + col.ColumnName); | 1628 | m_log.Info("[DATASTORE]: Missing required column:" + col.ColumnName); |
1627 | return false; | 1629 | return false; |
1628 | } | 1630 | } |
1629 | } | 1631 | } |
@@ -1634,7 +1636,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
1634 | { | 1636 | { |
1635 | if (!tmpDS.Tables["terrain"].Columns.Contains(col.ColumnName)) | 1637 | if (!tmpDS.Tables["terrain"].Columns.Contains(col.ColumnName)) |
1636 | { | 1638 | { |
1637 | MainLog.Instance.Verbose("DATASTORE", "Missing require column:" + col.ColumnName); | 1639 | m_log.Info("[DATASTORE]: Missing require column:" + col.ColumnName); |
1638 | return false; | 1640 | return false; |
1639 | } | 1641 | } |
1640 | } | 1642 | } |
@@ -1643,7 +1645,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
1643 | { | 1645 | { |
1644 | if (!tmpDS.Tables["land"].Columns.Contains(col.ColumnName)) | 1646 | if (!tmpDS.Tables["land"].Columns.Contains(col.ColumnName)) |
1645 | { | 1647 | { |
1646 | MainLog.Instance.Verbose("DATASTORE", "Missing require column:" + col.ColumnName); | 1648 | m_log.Info("[DATASTORE]: Missing require column:" + col.ColumnName); |
1647 | return false; | 1649 | return false; |
1648 | } | 1650 | } |
1649 | } | 1651 | } |
@@ -1652,7 +1654,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
1652 | { | 1654 | { |
1653 | if (!tmpDS.Tables["landaccesslist"].Columns.Contains(col.ColumnName)) | 1655 | if (!tmpDS.Tables["landaccesslist"].Columns.Contains(col.ColumnName)) |
1654 | { | 1656 | { |
1655 | MainLog.Instance.Verbose("DATASTORE", "Missing require column:" + col.ColumnName); | 1657 | m_log.Info("[DATASTORE]: Missing require column:" + col.ColumnName); |
1656 | return false; | 1658 | return false; |
1657 | } | 1659 | } |
1658 | } | 1660 | } |