use of com.serotonin.log.RollingIOLog in project ma-modules-public by infiniteautomation.
the class SerialDataSourceRT method initialize.
@Override
public void initialize() {
boolean connected = false;
try {
if (this.vo.isLogIO()) {
// PrintWriter log = new PrintWriter(new FileWriter(file, true));
int fileSize = (int) (vo.getIoLogFileSizeMBytes() * 1000000f);
int maxFiles = vo.getMaxHistoricalIOLogs();
ioLog = new RollingIOLog(getIOLogFileName(vo.getId()), Common.getLogsDir(), fileSize, maxFiles);
ioLog.log("Data source started");
}
connected = this.connect();
} catch (Exception e) {
LOG.debug("Error while initializing data source", e);
String msg = e.getMessage();
if (msg == null) {
msg = "Unknown";
}
raiseEvent(DATA_SOURCE_EXCEPTION_EVENT, System.currentTimeMillis(), true, new TranslatableMessage("event.serial.connectFailed", msg));
}
if (connected) {
returnToNormal(DATA_SOURCE_EXCEPTION_EVENT, System.currentTimeMillis());
}
super.initialize();
}
Aggregations