diff --git a/src/main/java/org/lgdcloudsim/core/CloudSim.java b/src/main/java/org/lgdcloudsim/core/CloudSim.java index 0a31e13e..37e6fb81 100644 --- a/src/main/java/org/lgdcloudsim/core/CloudSim.java +++ b/src/main/java/org/lgdcloudsim/core/CloudSim.java @@ -45,6 +45,11 @@ public class CloudSim implements Simulation { * The simulation time. */ double clock; + + /** + * The simulation time in string format. + */ + String clockStr; /** * A flag to indicate if the simulation is running or not. */ @@ -116,7 +121,7 @@ public class CloudSim implements Simulation { * Creates a new CloudSim instance. */ public CloudSim() { - clock = 0; + setClock(0); this.entityList = new ArrayList<>(); this.future = new FutureQueue(); this.deferred = new DeferredQueue(); @@ -132,12 +137,13 @@ public double clock() { @Override public String clockStr() { - return "%.2f ms".formatted(clock); + return clockStr; } @Override public Simulation setClock(double time) { this.clock = time; + this.clockStr = "%.2f ms".formatted(clock); return this; } diff --git a/src/main/java/org/lgdcloudsim/datacenter/CollaborationManagerSimple.java b/src/main/java/org/lgdcloudsim/datacenter/CollaborationManagerSimple.java index 33b3b5e9..a2b8060b 100644 --- a/src/main/java/org/lgdcloudsim/datacenter/CollaborationManagerSimple.java +++ b/src/main/java/org/lgdcloudsim/datacenter/CollaborationManagerSimple.java @@ -106,7 +106,7 @@ private void datacenterAddCollaborationId(Datacenter datacenter, int collaborati if (datacenter == null) return; Set collaborationIds = datacenter.getCollaborationIds(); if (collaborationIds.contains(collaborationId)) { - LOGGER.warn("the datacenter(" + datacenter + ") already belongs to the collaboration " + collaborationId); + LOGGER.warn("the datacenter({}) already belongs to the collaboration {}", datacenter, collaborationId); } else { collaborationIds.add(collaborationId); } @@ -163,7 +163,7 @@ private void datacenterRemoveCollaborationId(Datacenter datacenter, int collabor if (datacenter == null) return; Set collaborationIds = datacenter.getCollaborationIds(); if (!collaborationIds.contains(collaborationId)) { - LOGGER.warn("the datacenter(" + datacenter + ") does not belong to the collaboration " + collaborationId + " to be removed"); + LOGGER.warn("the datacenter({})'s collaborationIds: {}", datacenter, collaborationIds); } else { collaborationIds.remove(collaborationId); } diff --git a/src/main/java/org/lgdcloudsim/record/SqlRecordDetailScheduleTime.java b/src/main/java/org/lgdcloudsim/record/SqlRecordDetailScheduleTime.java index 6a277010..04c95dbc 100644 --- a/src/main/java/org/lgdcloudsim/record/SqlRecordDetailScheduleTime.java +++ b/src/main/java/org/lgdcloudsim/record/SqlRecordDetailScheduleTime.java @@ -168,7 +168,7 @@ public SqlRecordDetailScheduleTime(String dbDir, String dbName, String userReque try { conn = DriverManager.getConnection("jdbc:sqlite:" + this.dbPath); conn.setAutoCommit(false); - LOGGER.info("Opened " + this.dbPath + " successfully"); + LOGGER.info("Opened {} successfully", this.dbPath); stmt = conn.createStatement(); createUserRequestTable(); @@ -371,7 +371,7 @@ public void recordInstanceGroupAllInfo(InstanceGroup instanceGroup) { stmt.executeUpdate(sql); } catch (SQLException e) { e.printStackTrace(); - LOGGER.error("The instance group " + instanceGroup.getId() + " recorded error {}", e.getMessage()); + LOGGER.error("The instance group {} recorded error {}", instanceGroup.getId(), e.getMessage()); try { sql = "SELECT * FROM " + this.instanceGroupTableName + " WHERE id = " + instanceGroup.getId() + ";"; ResultSet rs = stmt.executeQuery(sql); diff --git a/src/main/java/org/lgdcloudsim/record/SqlRecordSimple.java b/src/main/java/org/lgdcloudsim/record/SqlRecordSimple.java index 6e272e4d..10ba9d33 100644 --- a/src/main/java/org/lgdcloudsim/record/SqlRecordSimple.java +++ b/src/main/java/org/lgdcloudsim/record/SqlRecordSimple.java @@ -148,7 +148,7 @@ public SqlRecordSimple(String dbDir, String dbName, String userRequestTableName, try { conn = DriverManager.getConnection("jdbc:sqlite:" + this.dbPath); conn.setAutoCommit(false); - LOGGER.info("Opened " + this.dbPath + " successfully"); + LOGGER.info("Opened {} successfully", this.dbPath); stmt = conn.createStatement(); createUserRequestTable();