本文整理汇总了Java中org.cloudbus.cloudsim.Log.setOutput方法的典型用法代码示例。如果您正苦于以下问题:Java Log.setOutput方法的具体用法?Java Log.setOutput怎么用?Java Log.setOutput使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.cloudbus.cloudsim.Log
的用法示例。
在下文中一共展示了Log.setOutput方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initLogOutput
import org.cloudbus.cloudsim.Log; //导入方法依赖的package包/类
/**
* Inits the log output.
*
* @param enableOutput the enable output
* @param outputToFile the output to file
* @param outputFolder the output folder
* @param workload the workload
* @param vmAllocationPolicy the vm allocation policy
* @param vmSelectionPolicy the vm selection policy
* @param parameter the parameter
* @throws IOException Signals that an I/O exception has occurred.
* @throws FileNotFoundException the file not found exception
*/
protected void initLogOutput(
boolean enableOutput,
boolean outputToFile,
String outputFolder,
String workload,
String vmAllocationPolicy,
String vmSelectionPolicy,
String parameter) throws IOException, FileNotFoundException {
setEnableOutput(enableOutput);
Log.setDisabled(!isEnableOutput());
if (isEnableOutput() && outputToFile) {
File folder = new File(outputFolder);
if (!folder.exists()) {
folder.mkdir();
}
File folder2 = new File(outputFolder + "/log");
if (!folder2.exists()) {
folder2.mkdir();
}
File file = new File(outputFolder + "/log/"
+ getExperimentName(workload, vmAllocationPolicy, vmSelectionPolicy, parameter) + ".txt");
file.createNewFile();
Log.setOutput(new FileOutputStream(file));
}
}
示例2: initLogOutput
import org.cloudbus.cloudsim.Log; //导入方法依赖的package包/类
/**
* Inits the log output.
*
* @param enableOutput
* the enable output
* @param outputToFile
* the output to file
* @param outputFolder
* the output folder
* @param workload
* the workload
* @param vmAllocationPolicy
* the vm allocation policy
* @param vmSelectionPolicy
* the vm selection policy
* @param parameter
* the parameter
* @throws IOException
* Signals that an I/O exception has occurred.
* @throws FileNotFoundException
* the file not found exception
*/
protected void initLogOutput(boolean enableOutput, boolean outputToFile,
String outputFolder, String workload, String vmAllocationPolicy,
String vmSelectionPolicy, String parameter) throws IOException,
FileNotFoundException {
setEnableOutput(enableOutput);
Log.setDisabled(!isEnableOutput());
// 如果允许日志输出,且是输出到文件
if (isEnableOutput() && outputToFile) {
File folder = new File(outputFolder);
if (!folder.exists()) {
folder.mkdir();
}
File folder2 = new File(outputFolder + "/log");
if (!folder2.exists()) {
folder2.mkdir();
}
// 日志文件坐在目录:/主机数/log/ 日志名:负载类型_过载判断算法_虚拟机选择算法_参数_算法名称
File file = new File(outputFolder
+ "/log/"
+ getExperimentName(workload, vmAllocationPolicy,
vmSelectionPolicy, parameter) + ".txt");
file.createNewFile();
Log.setOutput(new FileOutputStream(file));
}
}