这是indexloc提供的服务,不要输入任何密码
Skip to content

Replace Log class with the standard and widely used Logback Library #24

@manoelcampos

Description

@manoelcampos

Replace the CloudSim Log class by the Logback as logging engine and SL4J as logging facade.

An example scenario where this feature can be used

Log messages will be printed with different colors depending on the message type, as depicted below.

log-messages-by-type

Using Logback, you can even customize the log by creating a logback.xml file inside the resource directory of your simulation's project. The default CloudSim Plus configuration is defined here.

It also enables filtering simulation logs by different categories (namely ERROR, WARN, INFO, DEBUG and TRACE), giving a more fine-grained control over log messages. This way, debug process will be easier. It will enable the developer to show just the type of messages relevant to his/her experiments.

The line of code below shows an example of how to enable a specific level of log messages. It can be called before instantiating the CloudSim object.

//Make sure to import org.cloudsimplus.util.Log;
Log.setLevel(ch.qos.logback.classic.Level.WARN);

A brief explanation of why you think this feature is useful

The developer will be able to select the kind of logs he/she want to show, using a standard, well-known library. He/she will have more options when exporting the log and could create its own categories of log messages.

References

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions